Skip to content

Commit 3b84021

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 fa05c22 commit 3b84021

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
@@ -546,8 +546,9 @@ PostgreSQL documentation
546546
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
547547
<listitem>
548548
<para>
549-
Specifies parameters used to connect to the server, as a connection
550-
string. See <xref linkend="libpq-connstring"/> for more information.
549+
Specifies parameters used to connect to the server, as a <link
550+
linkend="libpq-connstring">connction string</link>; these
551+
will override any conflicting command line options.
551552
</para>
552553
<para>
553554
The option is called <literal>--dbname</literal> 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
@@ -1078,14 +1078,10 @@ PostgreSQL documentation
10781078
Specifies the name of the database to connect to. This is
10791079
equivalent to specifying <replaceable
10801080
class="parameter">dbname</replaceable> as the first non-option
1081-
argument on the command line.
1082-
</para>
1083-
<para>
1084-
If this parameter contains an <symbol>=</symbol> sign or starts
1085-
with a valid <acronym>URI</acronym> prefix
1086-
(<literal>postgresql://</literal>
1087-
or <literal>postgres://</literal>), it is treated as a
1088-
<parameter>conninfo</parameter> string. See <xref linkend="libpq-connect"/> for more information.
1081+
argument on the command line. The <replaceable>dbname</replaceable>
1082+
can be a <link linkend="libpq-connstring">connection string</link>.
1083+
If so, connection string parameters will override any conflicting
1084+
command line options.
10891085
</para>
10901086
</listitem>
10911087
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,9 @@ PostgreSQL documentation
508508
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
509509
<listitem>
510510
<para>
511-
Specifies parameters used to connect to the server, as a connection
512-
string. See <xref linkend="libpq-connstring"/> for more information.
511+
Specifies parameters used to connect to the server, as a <link
512+
linkend="libpq-connstring">connction string</link>; these
513+
will override any conflicting command line options.
513514
</para>
514515
<para>
515516
The option is called <literal>--dbname</literal> 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></option></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
@@ -253,8 +253,9 @@ PostgreSQL documentation
253253
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
254254
<listitem>
255255
<para>
256-
Specifies parameters used to connect to the server, as a connection
257-
string. See <xref linkend="libpq-connstring"/> for more information.
256+
Specifies parameters used to connect to the server, as a <link
257+
linkend="libpq-connstring">connction string</link>; these
258+
will override any conflicting command line options.
258259
</para>
259260
<para>
260261
The option is called <literal>--dbname</literal> 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
@@ -156,7 +156,10 @@ PostgreSQL documentation
156156
<para>
157157
Connect to database <replaceable
158158
class="parameter">dbname</replaceable> and restore directly
159-
into the database.
159+
into the database. The <replaceable>dbname</replaceable> can
160+
be a <link linkend="libpq-connstring">connection string</link>.
161+
If so, connection string parameters will override any conflicting
162+
command line options.
160163
</para>
161164
</listitem>
162165
</varlistentry>

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,10 @@ EOF
159159
Specifies the name of the database to connect to. This is
160160
equivalent to specifying <replaceable
161161
class="parameter">dbname</replaceable> as the first non-option
162-
argument on the command line.
163-
</para>
164-
<para>
165-
If this parameter contains an <symbol>=</symbol> sign or starts
166-
with a valid <acronym>URI</acronym> prefix
167-
(<literal>postgresql://</literal>
168-
or <literal>postgres://</literal>), it is treated as a
169-
<parameter>conninfo</parameter> string. See <xref
170-
linkend="libpq-connstring"/> for more information.
162+
argument on the command line. The <replaceable>dbname</replaceable>
163+
can be a <link linkend="libpq-connstring">connection string</link>.
164+
If so, connection string parameters will override any conflicting
165+
command line options.
171166
</para>
172167
</listitem>
173168
</varlistentry>
@@ -489,7 +484,7 @@ EOF
489484
<listitem>
490485
<para>
491486
Never issue a password prompt. If the server requires password
492-
authentication and a password is not available by other means
487+
authentication and a password is not available from other sources
493488
such as a <filename>.pgpass</filename> file, the connection
494489
attempt will fail. This option can be useful in batch jobs and
495490
scripts where no user is present to enter a password.
@@ -509,13 +504,15 @@ EOF
509504
<listitem>
510505
<para>
511506
Force <application>psql</application> to prompt for a
512-
password before connecting to a database.
507+
password before connecting to a database, even if the password will
508+
not be used.
513509
</para>
514510

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

0 commit comments

Comments
 (0)