aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuna Yao <github@me.zznq.buzz>2025-06-02 19:46:50 +0200
committerGitHub <noreply@github.com>2025-06-02 10:46:50 -0700
commit5e354a18a3d7f09a8d28917b0751967c07f87104 (patch)
treea5956b9db82dea4db59f6f17eba14a032e48ae48
parent90802cb2015e9293422912ff94d8e68d87733acc (diff)
downloadseaweedfs-5e354a18a3d7f09a8d28917b0751967c07f87104.tar.xz
seaweedfs-5e354a18a3d7f09a8d28917b0751967c07f87104.zip
Update filer upsert sqlstring for postgresql (#6835)
-rw-r--r--weed/command/scaffold/filer.toml16
1 files changed, 14 insertions, 2 deletions
diff --git a/weed/command/scaffold/filer.toml b/weed/command/scaffold/filer.toml
index e9f140576..24aeacef3 100644
--- a/weed/command/scaffold/filer.toml
+++ b/weed/command/scaffold/filer.toml
@@ -116,7 +116,13 @@ connection_max_open = 100
connection_max_lifetime_seconds = 0
# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
enableUpsert = true
-upsertQuery = """UPSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4)"""
+upsertQuery = """
+ INSERT INTO "%[1]s" (dirhash, name, directory, meta)
+ VALUES($1, $2, $3, $4)
+ ON CONFLICT (dirhash, name) DO UPDATE SET
+ directory=EXCLUDED.directory,
+ meta=EXCLUDED.meta
+"""
[postgres2]
enabled = false
@@ -141,7 +147,13 @@ connection_max_open = 100
connection_max_lifetime_seconds = 0
# if insert/upsert failing, you can disable upsert or update query syntax to match your RDBMS syntax:
enableUpsert = true
-upsertQuery = """UPSERT INTO "%[1]s" (dirhash,name,directory,meta) VALUES($1,$2,$3,$4)"""
+upsertQuery = """
+ INSERT INTO "%[1]s" (dirhash, name, directory, meta)
+ VALUES($1, $2, $3, $4)
+ ON CONFLICT (dirhash, name) DO UPDATE SET
+ directory=EXCLUDED.directory,
+ meta=EXCLUDED.meta
+"""
[cassandra2]
# CREATE TABLE filemeta (