While looking at something unrelated, I noticed that the vacuumdb docs mention the following:
vacuumdb might need to connect several times to the PostgreSQL server, asking for a password each time. IIUC this has been fixed since 83dec5a from 2015 (which was superceded by ff402ae), so I think this note (originally added in e0a77f5 from 2002) can now be removed. I also found that neither clusterdb nor reindexdb uses the allow_password_reuse parameter in connectDatabase(), and the reindexdb documentation contains the same note about repeatedly asking for a password (originally added in 85e9a5a from 2005). IMO we should allow password reuse for all three programs, and we should remove the aforementioned notes in the docs, too. This is what the attached patch does. Thoughts? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com
>From e6fa53e7a2b0903fc6a498f22f6b436b81b206ed Mon Sep 17 00:00:00 2001 From: Nathan Bossart <nat...@postgresql.org> Date: Tue, 27 Jun 2023 21:38:24 -0700 Subject: [PATCH v1 1/1] harmonize password reuse in vacuumdb, clusterdb, and reindexdb --- doc/src/sgml/ref/reindexdb.sgml | 14 -------------- doc/src/sgml/ref/vacuumdb.sgml | 13 ------------- src/bin/scripts/clusterdb.c | 2 +- src/bin/scripts/reindexdb.c | 2 +- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/doc/src/sgml/ref/reindexdb.sgml b/doc/src/sgml/ref/reindexdb.sgml index 8cb8bf4fa3..8d9ced212f 100644 --- a/doc/src/sgml/ref/reindexdb.sgml +++ b/doc/src/sgml/ref/reindexdb.sgml @@ -432,20 +432,6 @@ PostgreSQL documentation </refsect1> - - <refsect1> - <title>Notes</title> - - <para> - <application>reindexdb</application> might need to connect several - times to the <productname>PostgreSQL</productname> server, asking - for a password each time. It is convenient to have a - <filename>~/.pgpass</filename> file in such cases. See <xref - linkend="libpq-pgpass"/> for more information. - </para> - </refsect1> - - <refsect1> <title>Examples</title> diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index da2393783b..09356ea4fa 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -605,19 +605,6 @@ PostgreSQL documentation </refsect1> - - <refsect1> - <title>Notes</title> - - <para> - <application>vacuumdb</application> might need to connect several - times to the <productname>PostgreSQL</productname> server, asking - for a password each time. It is convenient to have a - <filename>~/.pgpass</filename> file in such cases. See <xref - linkend="libpq-pgpass"/> for more information. - </para> - </refsect1> - <refsect1> <title>Examples</title> diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index e3585b3272..1a7588d29c 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -195,7 +195,7 @@ cluster_one_database(const ConnParams *cparams, const char *table, PGconn *conn; - conn = connectDatabase(cparams, progname, echo, false, false); + conn = connectDatabase(cparams, progname, echo, false, true); initPQExpBuffer(&sql); diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index 3e8f6aca40..2eee8e351f 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -315,7 +315,7 @@ reindex_one_database(ConnParams *cparams, ReindexType type, bool failed = false; int items_count = 0; - conn = connectDatabase(cparams, progname, echo, false, false); + conn = connectDatabase(cparams, progname, echo, false, true); if (concurrently && PQserverVersion(conn) < 120000) { -- 2.25.1