mirror of https://github.com/postgres/postgres
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.compull/170/head
parent
5687f8c0dd
commit
c297a47c5f
@ -0,0 +1,16 @@ |
||||
/* contrib/postgres_fdw/postgres_fdw--1.1--1.2.sql */ |
||||
|
||||
-- complain if script is sourced in psql, rather than via ALTER EXTENSION |
||||
\echo Use "ALTER EXTENSION postgres_fdw UPDATE TO '1.2'" to load this file. \quit |
||||
|
||||
/* First we have to remove it from the extension */ |
||||
ALTER EXTENSION postgres_fdw DROP FUNCTION postgres_fdw_get_connections (); |
||||
|
||||
/* Then we can drop it */ |
||||
DROP FUNCTION postgres_fdw_get_connections (); |
||||
|
||||
CREATE FUNCTION postgres_fdw_get_connections (OUT server_name text, |
||||
OUT valid boolean, OUT used_in_xact boolean) |
||||
RETURNS SETOF record |
||||
AS 'MODULE_PATHNAME', 'postgres_fdw_get_connections_1_2' |
||||
LANGUAGE C STRICT PARALLEL RESTRICTED; |
@ -1,5 +1,5 @@ |
||||
# postgres_fdw extension |
||||
comment = 'foreign-data wrapper for remote PostgreSQL servers' |
||||
default_version = '1.1' |
||||
default_version = '1.2' |
||||
module_pathname = '$libdir/postgres_fdw' |
||||
relocatable = true |
||||
|
Loading…
Reference in new issue