aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2024-07-26 22:15:51 +0900
committerFujii Masao <fujii@postgresql.org>2024-07-26 22:15:51 +0900
commitc297a47c5f8da78d976e8c3f790dbeeb6a21a853 (patch)
tree46df1a1f4a115f6dd82ff15e21e096489695b09f /doc/src
parent5687f8c0dd766acb15587a0af8b5208aa3841b21 (diff)
downloadpostgresql-c297a47c5f8da78d976e8c3f790dbeeb6a21a853.tar.gz
postgresql-c297a47c5f8da78d976e8c3f790dbeeb6a21a853.zip
postgres_fdw: Add "used_in_xact" column to postgres_fdw_get_connections().
This commit extends the postgres_fdw_get_connections() function to include a new used_in_xact column, indicating whether each connection is used in the current transaction. This addition is particularly useful for the upcoming feature that will check if connections are closed. By using those information, users can verify if postgres_fdw connections used in a transaction remain open. If any connection is closed, the transaction cannot be committed successfully. In this case users can roll back it immediately without waiting for transaction end. The SQL API for postgres_fdw_get_connections() is updated by this commit and may change in the future. To handle compatibility with older SQL declarations, an API versioning system is introduced, allowing the function to behave differently based on the API version. Author: Hayato Kuroda Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/be9382f7-5072-4760-8b3f-31d6dffa8d62@oss.nttdata.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/postgres-fdw.sgml21
1 files changed, 15 insertions, 6 deletions
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index e0eac6705f1..b904f7a33ec 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -777,7 +777,9 @@ OPTIONS (ADD password_required 'false');
<variablelist>
<varlistentry>
- <term><function>postgres_fdw_get_connections(OUT server_name text, OUT valid boolean) returns setof record</function></term>
+ <term><function>postgres_fdw_get_connections(OUT server_name text,
+ OUT valid boolean, OUT used_in_xact boolean)
+ returns setof record</function></term>
<listitem>
<para>
This function returns information about all open connections postgres_fdw
@@ -785,11 +787,11 @@ OPTIONS (ADD password_required 'false');
no open connections, no records are returned.
Example usage of the function:
<screen>
-postgres=# SELECT * FROM postgres_fdw_get_connections() ORDER BY 1;
- server_name | valid
--------------+-------
- loopback1 | t
- loopback2 | f
+postgres=*# SELECT * FROM postgres_fdw_get_connections() ORDER BY 1;
+ server_name | valid | used_in_xact
+-------------+-------+--------------
+ loopback1 | t | t
+ loopback2 | f | t
</screen>
The output columns are described in
<xref linkend="postgres-fdw-get-connections-columns"/>.
@@ -827,6 +829,13 @@ postgres=# SELECT * FROM postgres_fdw_get_connections() ORDER BY 1;
the transaction. True is returned otherwise.
</entry>
</row>
+ <row>
+ <entry><structfield>used_in_xact</structfield></entry>
+ <entry><type>boolean</type></entry>
+ <entry>
+ True if this connection is used in the current transaction.
+ </entry>
+ </row>
</tbody>
</tgroup>
</table>