aboutsummaryrefslogtreecommitdiff
path: root/weed/credential/postgres/postgres_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/credential/postgres/postgres_store.go')
-rw-r--r--weed/credential/postgres/postgres_store.go7
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)
}