diff options
author | Etsuro Fujita | 2025-06-01 08:30:00 +0000 |
---|---|---|
committer | Etsuro Fujita | 2025-06-01 08:30:00 +0000 |
commit | e5a3c9d9b5ce535151d3a7e3173e8d27d2d8cd58 (patch) | |
tree | 3693798fef888b1241a158947636a811fcfa6c3b /doc/src | |
parent | b006bcd5310eb2dad0828a286b79babce4953143 (diff) |
postgres_fdw: Inherit the local transaction's access/deferrable modes.
Previously, postgres_fdw always 1) opened a remote transaction in READ
WRITE mode even when the local transaction was READ ONLY, causing a READ
ONLY transaction using it that references a foreign table mapped to a
remote view executing a volatile function to write in the remote side,
and 2) opened the remote transaction in NOT DEFERRABLE mode even when
the local transaction was DEFERRABLE, causing a SERIALIZABLE READ ONLY
DEFERRABLE transaction using it to abort due to a serialization failure
in the remote side.
To avoid these, modify postgres_fdw to open a remote transaction in the
same access/deferrable modes as the local transaction. This commit also
modifies it to open a remote subtransaction in the same access mode as
the local subtransaction.
Although these issues exist since the introduction of postgres_fdw,
there have been no reports from the field. So it seems fine to just fix
them in master only.
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAPmGK16n_hcUUWuOdmeUS%2Bw4Q6dZvTEDHb%3DOP%3D5JBzo-M3QmpQ%40mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/postgres-fdw.sgml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index 781a01067f7..c464716e3ce 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -1078,6 +1078,21 @@ postgres=# SELECT postgres_fdw_disconnect_all(); </para> <para> + The remote transaction is opened in the same read/write mode as the local + transaction: if the local transaction is <literal>READ ONLY</literal>, + the remote transaction is opened in <literal>READ ONLY</literal> mode, + otherwise it is opened in <literal>READ WRITE</literal> mode. + (This rule is also applied to remote and local subtransactions.) + </para> + + <para> + The remote transaction is also opened in the same deferrable mode as the + local transaction: if the local transaction is <literal>DEFERRABLE</literal>, + the remote transaction is opened in <literal>DEFERRABLE</literal> mode, + otherwise it is opened in <literal>NOT DEFERRABLE</literal> mode. + </para> + + <para> Note that it is currently not supported by <filename>postgres_fdw</filename> to prepare the remote transaction for two-phase commit. |