mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Doc: remove misleading info about ecpg's CONNECT/DISCONNECT DEFAULT.
As far as I can see, ecpg has no notion of a "default" open connection. You can do "CONNECT TO DEFAULT" but that just specifies letting libpq use all its default connection parameters --- the resulting connection is not special subsequently. In particular, SET CONNECTION = DEFAULT and DISCONNECT DEFAULT simply act on a connection named DEFAULT, if you've made one; they do not have special lookup rules. But the documentation of these commands makes it look like they do. Simplest fix, I think, is just to remove the paras suggesting that DEFAULT is special here. Also, SET CONNECTION *does* have one special lookup rule, which is that it recognizes CURRENT as an alias for the currently selected connection. SET CONNECTION = CURRENT is a no-op, so it's pretty useless, but nonetheless it does something different from selecting a connection by name; so we'd better document it. Per report from Sylvain Frandaz. Back-patch to all supported versions. Discussion: https://postgr.es/m/169824721149.1769274.1553568436817652238@wrigleys.postgresql.org
This commit is contained in:
parent
5a4c21e952
commit
70b59a2728
@ -412,12 +412,6 @@ EXEC SQL DISCONNECT <optional><replaceable>connection</replaceable></optional>;
|
|||||||
</simpara>
|
</simpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
|
||||||
<simpara>
|
|
||||||
<literal>DEFAULT</literal>
|
|
||||||
</simpara>
|
|
||||||
</listitem>
|
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<simpara>
|
<simpara>
|
||||||
<literal>CURRENT</literal>
|
<literal>CURRENT</literal>
|
||||||
@ -7093,7 +7087,6 @@ EXEC SQL DEALLOCATE DESCRIPTOR mydesc;
|
|||||||
<synopsis>
|
<synopsis>
|
||||||
DISCONNECT <replaceable class="parameter">connection_name</replaceable>
|
DISCONNECT <replaceable class="parameter">connection_name</replaceable>
|
||||||
DISCONNECT [ CURRENT ]
|
DISCONNECT [ CURRENT ]
|
||||||
DISCONNECT DEFAULT
|
|
||||||
DISCONNECT ALL
|
DISCONNECT ALL
|
||||||
</synopsis>
|
</synopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
@ -7134,15 +7127,6 @@ DISCONNECT ALL
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><literal>DEFAULT</literal></term>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Close the default connection.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>ALL</literal></term>
|
<term><literal>ALL</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
@ -7161,13 +7145,11 @@ DISCONNECT ALL
|
|||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
EXEC SQL CONNECT TO testdb AS DEFAULT USER testuser;
|
|
||||||
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
|
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
|
||||||
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
|
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
|
||||||
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
|
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
|
||||||
|
|
||||||
EXEC SQL DISCONNECT CURRENT; /* close con3 */
|
EXEC SQL DISCONNECT CURRENT; /* close con3 */
|
||||||
EXEC SQL DISCONNECT DEFAULT; /* close DEFAULT */
|
|
||||||
EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
|
EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -7736,10 +7718,10 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>DEFAULT</literal></term>
|
<term><literal>CURRENT</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Set the connection to the default connection.
|
Set the connection to the current connection (thus, nothing happens).
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user