Skip to content

Commit 65aa18e

Browse files
committed
doc: libpq connection options can override command-line flags
Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/16486-b9c93d71c02c4907@postgresql.org Backpatch-through: 9.5
1 parent 934bb65 commit 65aa18e

11 files changed

+53
-47
lines changed

doc/src/sgml/ref/clusterdb.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ PostgreSQL documentation
9595
<option>--all</option>) is not used, the database name is read
9696
from the environment variable <envar>PGDATABASE</envar>. If
9797
that is not set, the user name specified for the connection is
98-
used.
98+
used. The <replaceable>dbname</replaceable> can be a <link
99+
linkend="libpq-connstring">connection string</link>. If so,
100+
connection string parameters will override any conflicting command
101+
line options.
99102
</para>
100103
</listitem>
101104
</varlistentry>

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,9 @@ PostgreSQL documentation
515515
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
516516
<listitem>
517517
<para>
518-
Specifies parameters used to connect to the server, as a connection
519-
string. See <xref linkend="libpq-connstring"> for more information.
518+
Specifies parameters used to connect to the server, as a <link
519+
linkend="libpq-connstring">connction string</link>; these
520+
will override any conflicting command line options.
520521
</para>
521522
<para>
522523
The option is called <literal>--dbname</> for consistency with other

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,14 +1028,10 @@ PostgreSQL documentation
10281028
Specifies the name of the database to connect to. This is
10291029
equivalent to specifying <replaceable
10301030
class="parameter">dbname</replaceable> as the first non-option
1031-
argument on the command line.
1032-
</para>
1033-
<para>
1034-
If this parameter contains an <symbol>=</symbol> sign or starts
1035-
with a valid <acronym>URI</acronym> prefix
1036-
(<literal>postgresql://</literal>
1037-
or <literal>postgres://</literal>), it is treated as a
1038-
<parameter>conninfo</parameter> string. See <xref linkend="libpq-connect"> for more information.
1031+
argument on the command line. The <replaceable>dbname</replaceable>
1032+
can be a <link linkend="libpq-connstring">connection string</link>.
1033+
If so, connection string parameters will override any conflicting
1034+
command line options.
10391035
</para>
10401036
</listitem>
10411037
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,9 @@ PostgreSQL documentation
467467
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
468468
<listitem>
469469
<para>
470-
Specifies parameters used to connect to the server, as a connection
471-
string. See <xref linkend="libpq-connstring"> for more information.
470+
Specifies parameters used to connect to the server, as a <link
471+
linkend="libpq-connstring">connction string</link>; these
472+
will override any conflicting command line options.
472473
</para>
473474
<para>
474475
The option is called <literal>--dbname</> for consistency with other

doc/src/sgml/ref/pg_isready.sgml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@ PostgreSQL documentation
4747
<term><option>--dbname=<replaceable class="parameter">dbname</replaceable></></term>
4848
<listitem>
4949
<para>
50-
Specifies the name of the database to connect to.
51-
</para>
52-
<para>
53-
If this parameter contains an <symbol>=</symbol> sign or starts
54-
with a valid <acronym>URI</acronym> prefix
55-
(<literal>postgresql://</literal>
56-
or <literal>postgres://</literal>), it is treated as a
57-
<parameter>conninfo</parameter> string. See <xref
58-
linkend="libpq-connstring"> for more information.
50+
Specifies the name of the database to connect to. The
51+
<replaceable>dbname</replaceable> can be a <link
52+
linkend="libpq-connstring">connection string</link>. If so,
53+
connection string parameters will override any conflicting command
54+
line options.
5955
</para>
6056
</listitem>
6157
</varlistentry>

doc/src/sgml/ref/pg_receivewal.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ PostgreSQL documentation
214214
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
215215
<listitem>
216216
<para>
217-
Specifies parameters used to connect to the server, as a connection
218-
string. See <xref linkend="libpq-connstring"> for more information.
217+
Specifies parameters used to connect to the server, as a <link
218+
linkend="libpq-connstring">connction string</link>; these
219+
will override any conflicting command line options.
219220
</para>
220221
<para>
221222
The option is called <literal>--dbname</> for consistency with other

doc/src/sgml/ref/pg_recvlogical.sgml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,16 @@ PostgreSQL documentation
273273

274274
<variablelist>
275275
<varlistentry>
276-
<term><option>-d <replaceable>database</replaceable></option></term>
277-
<term><option>--dbname=<replaceable>database</replaceable></option></term>
276+
<term><option>-d <replaceable>dbname</replaceable></option></term>
277+
<term><option>--dbname=<replaceable>dbname</replaceable></option></term>
278278
<listitem>
279279
<para>
280-
The database to connect to. See the description of the actions for
281-
what this means in detail. This can be a <application>libpq</application> connection string;
282-
see <xref linkend="LIBPQ-CONNSTRING"> for more information. Defaults
283-
to user name.
280+
The database to connect to. See the description
281+
of the actions for what this means in detail.
282+
The <replaceable>dbname</replaceable> can be a <link
283+
linkend="libpq-connstring">connection string</link>. If so,
284+
connection string parameters will override any conflicting
285+
command line options. Defaults to the user name.
284286
</para>
285287
</listitem>
286288
</varlistentry>

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ PostgreSQL documentation
145145
<para>
146146
Connect to database <replaceable
147147
class="parameter">dbname</replaceable> and restore directly
148-
into the database.
148+
into the database. The <replaceable>dbname</replaceable> can
149+
be a <link linkend="libpq-connstring">connection string</link>.
150+
If so, connection string parameters will override any conflicting
151+
command line options.
149152
</para>
150153
</listitem>
151154
</varlistentry>

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,10 @@ EOF
157157
Specifies the name of the database to connect to. This is
158158
equivalent to specifying <replaceable
159159
class="parameter">dbname</replaceable> as the first non-option
160-
argument on the command line.
161-
</para>
162-
<para>
163-
If this parameter contains an <symbol>=</symbol> sign or starts
164-
with a valid <acronym>URI</acronym> prefix
165-
(<literal>postgresql://</literal>
166-
or <literal>postgres://</literal>), it is treated as a
167-
<parameter>conninfo</parameter> string. See <xref
168-
linkend="libpq-connstring"> for more information.
160+
argument on the command line. The <replaceable>dbname</replaceable>
161+
can be a <link linkend="libpq-connstring">connection string</link>.
162+
If so, connection string parameters will override any conflicting
163+
command line options.
169164
</para>
170165
</listitem>
171166
</varlistentry>
@@ -487,7 +482,7 @@ EOF
487482
<listitem>
488483
<para>
489484
Never issue a password prompt. If the server requires password
490-
authentication and a password is not available by other means
485+
authentication and a password is not available from other sources
491486
such as a <filename>.pgpass</filename> file, the connection
492487
attempt will fail. This option can be useful in batch jobs and
493488
scripts where no user is present to enter a password.
@@ -507,13 +502,15 @@ EOF
507502
<listitem>
508503
<para>
509504
Force <application>psql</application> to prompt for a
510-
password before connecting to a database.
505+
password before connecting to a database, even if the password will
506+
not be used.
511507
</para>
512508

513509
<para>
514-
This option is never essential, since <application>psql</application>
515-
will automatically prompt for a password if the server demands
516-
password authentication. However, <application>psql</application>
510+
If the server requires password authentication and a password is not
511+
available from other sources such as a <filename>.pgpass</filename>
512+
file, <application>psql</application> will prompt for a
513+
password in any case. However, <application>psql</application>
517514
will waste a connection attempt finding out that the server wants a
518515
password. In some cases it is worth typing <option>-W</> to avoid
519516
the extra connection attempt.

doc/src/sgml/ref/reindexdb.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ PostgreSQL documentation
128128
<option>--all</option>) is not used, the database name is read
129129
from the environment variable <envar>PGDATABASE</envar>. If
130130
that is not set, the user name specified for the connection is
131-
used.
131+
used. The <replaceable>dbname</replaceable> can be a <link
132+
linkend="libpq-connstring">connection string</link>. If so,
133+
connection string parameters will override any conflicting command
134+
line options.
132135
</para>
133136
</listitem>
134137
</varlistentry>

doc/src/sgml/ref/vacuumdb.sgml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ PostgreSQL documentation
9797
<option>--all</option>) is not used, the database name is read
9898
from the environment variable <envar>PGDATABASE</envar>. If
9999
that is not set, the user name specified for the connection is
100-
used.
100+
used. The <replaceable>dbname</replaceable> can be a <link
101+
linkend="libpq-connstring">connection string</link>. If so,
102+
connection string parameters will override any conflicting command
103+
line options.
101104
</para>
102105
</listitem>
103106
</varlistentry>

0 commit comments

Comments
 (0)