aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/reindexdb.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2015-11-12 18:05:23 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2015-11-12 18:05:23 -0300
commit5094da99b901df42580b6e7494d036ee4be9eb81 (patch)
treef879bf36a6d9c73811447fb114788ac7a12bb350 /src/bin/scripts/reindexdb.c
parent747854f010b168c4f076cf44b61b100b0fe20866 (diff)
downloadpostgresql-5094da99b901df42580b6e7494d036ee4be9eb81.tar.gz
postgresql-5094da99b901df42580b6e7494d036ee4be9eb81.zip
vacuumdb: don't prompt for passwords over and over
Having the script prompt for passwords over and over was a preexisting problem when it processed multiple databases or when it processed multiple analyze stages, but the parallel mode introduced in commit a179232047 made it worse. Fix the annoyance by keeping a copy of the password used by the first connection that requires one. Since users can (currently) only have a single password, there's no need for more complex arrangements (such as remembering one password per database). Per bug #13741 reported by Eric Brown. Patch authored and cross-reviewed by Haribabu Kommi and Michael Paquier, slightly tweaked by Álvaro Herrera. Discussion: http://www.postgresql.org/message-id/20151027193919.931.54948@wrigleys.postgresql.org Backpatch to 9.5, where parallel vacuumdb was introduced.
Diffstat (limited to 'src/bin/scripts/reindexdb.c')
-rw-r--r--src/bin/scripts/reindexdb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c
index decb7538db5..fbf436c6d59 100644
--- a/src/bin/scripts/reindexdb.c
+++ b/src/bin/scripts/reindexdb.c
@@ -297,8 +297,8 @@ reindex_one_database(const char *name, const char *dbname, const char *type,
appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name));
appendPQExpBufferChar(&sql, ';');
- conn = connectDatabase(dbname, host, port, username, prompt_password,
- progname, false);
+ conn = connectDatabase(dbname, host, port, username, NULL,
+ prompt_password, progname, false);
if (!executeMaintenanceCommand(conn, sql.data, echo))
{
@@ -372,8 +372,8 @@ reindex_system_catalogs(const char *dbname, const char *host, const char *port,
appendPQExpBuffer(&sql, " SYSTEM %s;", dbname);
- conn = connectDatabase(dbname, host, port, username, prompt_password,
- progname, false);
+ conn = connectDatabase(dbname, host, port, username, NULL,
+ prompt_password, progname, false);
if (!executeMaintenanceCommand(conn, sql.data, echo))
{
fprintf(stderr, _("%s: reindexing of system catalogs failed: %s"),