diff options
author | Tom Lane | 2023-10-25 21:34:47 +0000 |
---|---|---|
committer | Tom Lane | 2023-10-25 21:34:51 +0000 |
commit | bddc2f7480374023218427a0185145a127207c28 (patch) | |
tree | b7af291426395cd3a8d6ef4b770b22578280a2bb /doc/src | |
parent | fdeb6e6a74f26e7b4504d358ffc751a6d74c08ab (diff) |
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/[email protected]
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ecpg.sgml | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/doc/src/sgml/ecpg.sgml b/doc/src/sgml/ecpg.sgml index 25c62d76367..dd576c275e8 100644 --- a/doc/src/sgml/ecpg.sgml +++ b/doc/src/sgml/ecpg.sgml @@ -414,12 +414,6 @@ EXEC SQL DISCONNECT <optional><replaceable>connection</replaceable></optional>; <listitem> <simpara> - <literal>DEFAULT</literal> - </simpara> - </listitem> - - <listitem> - <simpara> <literal>CURRENT</literal> </simpara> </listitem> @@ -7130,7 +7124,6 @@ EXEC SQL DEALLOCATE DESCRIPTOR mydesc; <synopsis> DISCONNECT <replaceable class="parameter">connection_name</replaceable> DISCONNECT [ CURRENT ] -DISCONNECT DEFAULT DISCONNECT ALL </synopsis> </refsynopsisdiv> @@ -7171,15 +7164,6 @@ DISCONNECT ALL </listitem> </varlistentry> - <varlistentry id="ecpg-sql-disconnect-default"> - <term><literal>DEFAULT</literal></term> - <listitem> - <para> - Close the default connection. - </para> - </listitem> - </varlistentry> - <varlistentry id="ecpg-sql-disconnect-all"> <term><literal>ALL</literal></term> <listitem> @@ -7198,13 +7182,11 @@ DISCONNECT ALL int 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 con2 USER testuser; EXEC SQL CONNECT TO testdb AS con3 USER testuser; EXEC SQL DISCONNECT CURRENT; /* close con3 */ - EXEC SQL DISCONNECT DEFAULT; /* close DEFAULT */ EXEC SQL DISCONNECT ALL; /* close con2 and con1 */ return 0; @@ -7772,11 +7754,11 @@ SET CONNECTION [ TO | = ] <replaceable class="parameter">connection_name</replac </listitem> </varlistentry> - <varlistentry id="ecpg-sql-set-connection-default"> - <term><literal>DEFAULT</literal></term> + <varlistentry id="ecpg-sql-set-connection-current"> + <term><literal>CURRENT</literal></term> <listitem> <para> - Set the connection to the default connection. + Set the connection to the current connection (thus, nothing happens). </para> </listitem> </varlistentry> |