Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: change the ordering of guessing databases (#4163)
Danny Xub7e9cd4b0bbc
diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.goindex f38a96edcc..c4de351a63 100644--- a/plugin/db/pg/pg.go+++ b/plugin/db/pg/pg.go@@ -152,8 +152,7 @@ func guessDSN(username, password, hostname, port, database, sslCA, sslCert, sslK// Some postgres server default behavior is to use username as the database name if not specified,// while some postgres server explicitly requires the database name to be present (e.g. render.com).- // Thus we explicitly guess username as the database name at first.- guesses := []string{username, "bytebase", "postgres", "template1"}+ guesses := []string{"postgres", "bytebase", username, "template1"}// dsn+" dbname=bytebase"for _, guessDatabase := range guesses {guessDSN := fmt.Sprintf("%s dbname=%s", dsn, guessDatabase)