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
This commit is contained in:
Bruce Momjian 2020-10-02 22:19:31 -04:00
parent 472e518a44
commit 1a9388bd0f
11 changed files with 53 additions and 47 deletions

View File

@ -95,7 +95,10 @@ PostgreSQL documentation
<option>--all</option>) is not used, the database name is read <option>--all</option>) is not used, the database name is read
from the environment variable <envar>PGDATABASE</envar>. If from the environment variable <envar>PGDATABASE</envar>. If
that is not set, the user name specified for the connection is that is not set, the user name specified for the connection is
used. used. The <replaceable>dbname</replaceable> can be a <link
linkend="libpq-connstring">connection string</link>. If so,
connection string parameters will override any conflicting command
line options.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -653,8 +653,9 @@ PostgreSQL documentation
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term> <term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies parameters used to connect to the server, as a connection Specifies parameters used to connect to the server, as a <link
string. See <xref linkend="libpq-connstring"/> for more information. linkend="libpq-connstring">connction string</link>; these
will override any conflicting command line options.
</para> </para>
<para> <para>
The option is called <literal>--dbname</literal> for consistency with other The option is called <literal>--dbname</literal> for consistency with other

View File

@ -1132,14 +1132,10 @@ PostgreSQL documentation
Specifies the name of the database to connect to. This is Specifies the name of the database to connect to. This is
equivalent to specifying <replaceable equivalent to specifying <replaceable
class="parameter">dbname</replaceable> as the first non-option class="parameter">dbname</replaceable> as the first non-option
argument on the command line. argument on the command line. The <replaceable>dbname</replaceable>
</para> can be a <link linkend="libpq-connstring">connection string</link>.
<para> If so, connection string parameters will override any conflicting
If this parameter contains an <symbol>=</symbol> sign or starts command line options.
with a valid <acronym>URI</acronym> prefix
(<literal>postgresql://</literal>
or <literal>postgres://</literal>), it is treated as a
<parameter>conninfo</parameter> string. See <xref linkend="libpq-connect"/> for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -552,8 +552,9 @@ PostgreSQL documentation
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term> <term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies parameters used to connect to the server, as a connection Specifies parameters used to connect to the server, as a <link
string. See <xref linkend="libpq-connstring"/> for more information. linkend="libpq-connstring">connction string</link>; these
will override any conflicting command line options.
</para> </para>
<para> <para>
The option is called <literal>--dbname</literal> for consistency with other The option is called <literal>--dbname</literal> for consistency with other

View File

@ -47,15 +47,11 @@ PostgreSQL documentation
<term><option>--dbname=<replaceable class="parameter">dbname</replaceable></option></term> <term><option>--dbname=<replaceable class="parameter">dbname</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies the name of the database to connect to. Specifies the name of the database to connect to. The
</para> <replaceable>dbname</replaceable> can be a <link
<para> linkend="libpq-connstring">connection string</link>. If so,
If this parameter contains an <symbol>=</symbol> sign or starts connection string parameters will override any conflicting command
with a valid <acronym>URI</acronym> prefix line options.
(<literal>postgresql://</literal>
or <literal>postgres://</literal>), it is treated as a
<parameter>conninfo</parameter> string. See <xref
linkend="libpq-connstring"/> for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -252,8 +252,9 @@ PostgreSQL documentation
<term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term> <term><option>--dbname=<replaceable class="parameter">connstr</replaceable></option></term>
<listitem> <listitem>
<para> <para>
Specifies parameters used to connect to the server, as a connection Specifies parameters used to connect to the server, as a <link
string. See <xref linkend="libpq-connstring"/> for more information. linkend="libpq-connstring">connction string</link>; these
will override any conflicting command line options.
</para> </para>
<para> <para>
The option is called <literal>--dbname</literal> for consistency with other The option is called <literal>--dbname</literal> for consistency with other

View File

@ -273,14 +273,16 @@ PostgreSQL documentation
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><option>-d <replaceable>database</replaceable></option></term> <term><option>-d <replaceable>dbname</replaceable></option></term>
<term><option>--dbname=<replaceable>database</replaceable></option></term> <term><option>--dbname=<replaceable>dbname</replaceable></option></term>
<listitem> <listitem>
<para> <para>
The database to connect to. See the description of the actions for The database to connect to. See the description
what this means in detail. This can be a <application>libpq</application> connection string; of the actions for what this means in detail.
see <xref linkend="libpq-connstring"/> for more information. Defaults The <replaceable>dbname</replaceable> can be a <link
to user name. linkend="libpq-connstring">connection string</link>. If so,
connection string parameters will override any conflicting
command line options. Defaults to the user name.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -156,7 +156,10 @@ PostgreSQL documentation
<para> <para>
Connect to database <replaceable Connect to database <replaceable
class="parameter">dbname</replaceable> and restore directly class="parameter">dbname</replaceable> and restore directly
into the database. into the database. The <replaceable>dbname</replaceable> can
be a <link linkend="libpq-connstring">connection string</link>.
If so, connection string parameters will override any conflicting
command line options.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -168,15 +168,10 @@ EOF
Specifies the name of the database to connect to. This is Specifies the name of the database to connect to. This is
equivalent to specifying <replaceable equivalent to specifying <replaceable
class="parameter">dbname</replaceable> as the first non-option class="parameter">dbname</replaceable> as the first non-option
argument on the command line. argument on the command line. The <replaceable>dbname</replaceable>
</para> can be a <link linkend="libpq-connstring">connection string</link>.
<para> If so, connection string parameters will override any conflicting
If this parameter contains an <symbol>=</symbol> sign or starts command line options.
with a valid <acronym>URI</acronym> prefix
(<literal>postgresql://</literal>
or <literal>postgres://</literal>), it is treated as a
<parameter>conninfo</parameter> string. See <xref
linkend="libpq-connstring"/> for more information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -498,7 +493,7 @@ EOF
<listitem> <listitem>
<para> <para>
Never issue a password prompt. If the server requires password Never issue a password prompt. If the server requires password
authentication and a password is not available by other means authentication and a password is not available from other sources
such as a <filename>.pgpass</filename> file, the connection such as a <filename>.pgpass</filename> file, the connection
attempt will fail. This option can be useful in batch jobs and attempt will fail. This option can be useful in batch jobs and
scripts where no user is present to enter a password. scripts where no user is present to enter a password.
@ -518,13 +513,15 @@ EOF
<listitem> <listitem>
<para> <para>
Force <application>psql</application> to prompt for a Force <application>psql</application> to prompt for a
password before connecting to a database. password before connecting to a database, even if the password will
not be used.
</para> </para>
<para> <para>
This option is never essential, since <application>psql</application> If the server requires password authentication and a password is not
will automatically prompt for a password if the server demands available from other sources such as a <filename>.pgpass</filename>
password authentication. However, <application>psql</application> file, <application>psql</application> will prompt for a
password in any case. However, <application>psql</application>
will waste a connection attempt finding out that the server wants a will waste a connection attempt finding out that the server wants a
password. In some cases it is worth typing <option>-W</option> to avoid password. In some cases it is worth typing <option>-W</option> to avoid
the extra connection attempt. the extra connection attempt.

View File

@ -139,7 +139,10 @@ PostgreSQL documentation
<option>--all</option>) is not used, the database name is read <option>--all</option>) is not used, the database name is read
from the environment variable <envar>PGDATABASE</envar>. If from the environment variable <envar>PGDATABASE</envar>. If
that is not set, the user name specified for the connection is that is not set, the user name specified for the connection is
used. used. The <replaceable>dbname</replaceable> can be a <link
linkend="libpq-connstring">connection string</link>. If so,
connection string parameters will override any conflicting command
line options.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -97,7 +97,10 @@ PostgreSQL documentation
<option>--all</option>) is not used, the database name is read <option>--all</option>) is not used, the database name is read
from the environment variable <envar>PGDATABASE</envar>. If from the environment variable <envar>PGDATABASE</envar>. If
that is not set, the user name specified for the connection is that is not set, the user name specified for the connection is
used. used. The <replaceable>dbname</replaceable> can be a <link
linkend="libpq-connstring">connection string</link>. If so,
connection string parameters will override any conflicting command
line options.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>