diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-08-03 11:56:04 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-03 11:56:04 -0700 |
| commit | 4fb7bbb215605f1be5c3fd2f06d2105921913d0e (patch) | |
| tree | b45b8674fdc64824c71176be38eee927cce74f5e /weed/credential/postgres/postgres_store.go | |
| parent | d49b44f2a4a67e7a630f2d9248a2ce1819d10fc0 (diff) | |
| download | seaweedfs-4fb7bbb215605f1be5c3fd2f06d2105921913d0e.tar.xz seaweedfs-4fb7bbb215605f1be5c3fd2f06d2105921913d0e.zip | |
Filer Store: postgres backend support pgbouncer (#7077)
support pgbouncer
Diffstat (limited to 'weed/credential/postgres/postgres_store.go')
| -rw-r--r-- | weed/credential/postgres/postgres_store.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/credential/postgres/postgres_store.go b/weed/credential/postgres/postgres_store.go index c5fa6e727..58cb3f868 100644 --- a/weed/credential/postgres/postgres_store.go +++ b/weed/credential/postgres/postgres_store.go @@ -8,7 +8,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/credential" "github.com/seaweedfs/seaweedfs/weed/util" - _ "github.com/lib/pq" + _ "github.com/jackc/pgx/v5/stdlib" ) func init() { @@ -52,11 +52,12 @@ func (store *PostgresStore) Initialize(configuration util.Configuration, prefix sslmode = "disable" } - // Build connection string + // Build pgx-optimized connection string + // Note: prefer_simple_protocol=true is only needed for PgBouncer, not direct PostgreSQL connections connStr := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=%s search_path=%s", hostname, port, username, password, database, sslmode, schema) - db, err := sql.Open("postgres", connStr) + db, err := sql.Open("pgx", connStr) if err != nil { return fmt.Errorf("failed to open database: %w", err) } |
