Skip to content

Commit 9e8a18d

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 93e1d5c commit 9e8a18d

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>
@@ -6879,7 +6873,6 @@ EXEC SQL DEALLOCATE DESCRIPTOR mydesc;
68796873
<synopsis>
68806874
DISCONNECT <replaceable class="parameter">connection_name</replaceable>
68816875
DISCONNECT [ CURRENT ]
6882-
DISCONNECT DEFAULT
68836876
DISCONNECT ALL
68846877
</synopsis>
68856878
</refsynopsisdiv>
@@ -6920,15 +6913,6 @@ DISCONNECT ALL
69206913
</listitem>
69216914
</varlistentry>
69226915

6923-
<varlistentry>
6924-
<term><literal>DEFAULT</literal></term>
6925-
<listitem>
6926-
<para>
6927-
Close the default connection.
6928-
</para>
6929-
</listitem>
6930-
</varlistentry>
6931-
69326916
<varlistentry>
69336917
<term><literal>ALL</literal></term>
69346918
<listitem>
@@ -6947,13 +6931,11 @@ DISCONNECT ALL
69476931
int
69486932
main(void)
69496933
{
6950-
EXEC SQL CONNECT TO testdb AS DEFAULT USER testuser;
69516934
EXEC SQL CONNECT TO testdb AS con1 USER testuser;
69526935
EXEC SQL CONNECT TO testdb AS con2 USER testuser;
69536936
EXEC SQL CONNECT TO testdb AS con3 USER testuser;
69546937

69556938
EXEC SQL DISCONNECT CURRENT; /* close con3 */
6956-
EXEC SQL DISCONNECT DEFAULT; /* close DEFAULT */
69576939
EXEC SQL DISCONNECT ALL; /* close con2 and con1 */
69586940

69596941
return 0;
@@ -7473,10 +7455,10 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac
74737455
</varlistentry>
74747456

74757457
<varlistentry>
7476-
<term><literal>DEFAULT</literal></term>
7458+
<term><literal>CURRENT</literal></term>
74777459
<listitem>
74787460
<para>
7479-
Set the connection to the default connection.
7461+
Set the connection to the current connection (thus, nothing happens).
74807462
</para>
74817463
</listitem>
74827464
</varlistentry>

0 commit comments

Comments
 (0)