Skip to content

Commit c45a45f

Browse files
committed
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
1 parent 85b9e88 commit c45a45f

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

doc/src/sgml/ecpg.sgml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,6 @@ EXEC SQL DISCONNECT <optional><replaceable>connection</replaceable></optional>;
343343
</simpara>
344344
</listitem>
345345

346-
<listitem>
347-
<simpara>
348-
<literal>DEFAULT</literal>
349-
</simpara>
350-
</listitem>
351-
352346
<listitem>
353347
<simpara>
354348
<literal>CURRENT</literal>
@@ -6909,7 +6903,6 @@ EXEC SQL DEALLOCATE DESCRIPTOR mydesc;
69096903
<synopsis>
69106904
DISCONNECT <replaceable class="parameter">connection_name</replaceable>
69116905
DISCONNECT [ CURRENT ]
6912-
DISCONNECT DEFAULT
69136906
DISCONNECT ALL
69146907
</synopsis>
69156908
</refsynopsisdiv>
@@ -6950,15 +6943,6 @@ DISCONNECT ALL
69506943
</listitem>
69516944
</varlistentry>
69526945

6953-
<varlistentry>
6954-
<term><literal>DEFAULT</literal></term>
6955-
<listitem>
6956-
<para>
6957-
Close the default connection.
6958-
</para>
6959-
</listitem>
6960-
</varlistentry>
6961-
69626946
<varlistentry>
69636947
<term><literal>ALL</literal></term>
69646948
<listitem>
@@ -6977,13 +6961,11 @@ DISCONNECT ALL
69776961
int
69786962
main(void)
69796963
{
6980-
EXEC SQL CONNECT TO testdb AS DEFAULT USER testuser;
69816964
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
69826965
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
69836966
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
69846967

69856968
EXEC SQL DISCONNECT CURRENT; /* close con3 */
6986-
EXEC SQL DISCONNECT DEFAULT; /* close DEFAULT */
69876969
EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
69886970

69896971
return 0;
@@ -7503,10 +7485,10 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac
75037485
</varlistentry>
75047486

75057487
<varlistentry>
7506-
<term><literal>DEFAULT</literal></term>
7488+
<term><literal>CURRENT</literal></term>
75077489
<listitem>
75087490
<para>
7509-
Set the connection to the default connection.
7491+
Set the connection to the current connection (thus, nothing happens).
75107492
</para>
75117493
</listitem>
75127494
</varlistentry>

0 commit comments

Comments
 (0)