mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
postgres_fdw: Fix error message for PREPARE TRANSACTION.
Currently, postgres_fdw does not support preparing a remote transaction for two-phase commit even in the case where the remote transaction is read-only, but the old error message appeared to imply that that was not supported only if the remote transaction modified remote tables. Change the message so as to include the case where the remote transaction is read-only. Also fix a comment above the message. Also add a note about the lack of supporting PREPARE TRANSACTION to the postgres_fdw documentation. Reported-by: Gilles Darold Author: Gilles Darold and Etsuro Fujita Reviewed-by: Michael Paquier and Kyotaro Horiguchi Backpatch-through: 9.4 Discussion: https://postgr.es/m/08600ed3-3084-be70-65ba-279ab19618a5%40darold.net
This commit is contained in:
parent
685d6cb8cd
commit
bca0aed2d0
@ -728,17 +728,17 @@ pgfdw_xact_callback(XactEvent event, void *arg)
|
|||||||
case XACT_EVENT_PRE_PREPARE:
|
case XACT_EVENT_PRE_PREPARE:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We disallow remote transactions that modified anything,
|
* We disallow any remote transactions, since it's not
|
||||||
* since it's not very reasonable to hold them open until
|
* very reasonable to hold them open until the prepared
|
||||||
* the prepared transaction is committed. For the moment,
|
* transaction is committed. For the moment, throw error
|
||||||
* throw error unconditionally; later we might allow
|
* unconditionally; later we might allow read-only cases.
|
||||||
* read-only cases. Note that the error will cause us to
|
* Note that the error will cause us to come right back
|
||||||
* come right back here with event == XACT_EVENT_ABORT, so
|
* here with event == XACT_EVENT_ABORT, so we'll clean up
|
||||||
* we'll clean up the connection state at that point.
|
* the connection state at that point.
|
||||||
*/
|
*/
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("cannot prepare a transaction that modified remote tables")));
|
errmsg("cannot PREPARE a transaction that has operated on postgres_fdw foreign tables")));
|
||||||
break;
|
break;
|
||||||
case XACT_EVENT_PARALLEL_COMMIT:
|
case XACT_EVENT_PARALLEL_COMMIT:
|
||||||
case XACT_EVENT_COMMIT:
|
case XACT_EVENT_COMMIT:
|
||||||
|
@ -468,6 +468,12 @@
|
|||||||
COMMITTED</> local transaction. A future
|
COMMITTED</> local transaction. A future
|
||||||
<productname>PostgreSQL</productname> release might modify these rules.
|
<productname>PostgreSQL</productname> release might modify these rules.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Note that it is currently not supported by
|
||||||
|
<filename>postgres_fdw</filename> to prepare the remote transaction for
|
||||||
|
two-phase commit.
|
||||||
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2>
|
<sect2>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user