From 32405d0398106e57beec2454fba70e8cdd830209 Mon Sep 17 00:00:00 2001 From: Etsuro Fujita Date: Wed, 6 Nov 2019 12:50:21 +0900 Subject: [PATCH] postgres_fdw: Fix error message for PREPARE TRANSACTION. Currently, postgres_fdw does not support preparing a remote transaction for two-phase commit even if it is a read-only transaction, but the old error message appeared to imply that that was not supported if the remote transaction modified remote tables. Change the error message so as to include the case where the remote transaction is read-only. Also add a note about the lack of supporting PREPARE TRANSACTION to the postgres_fdw documentation. Back-patch to all supported branches. Reported-by: Gilles Darold Author: Gilles Darold and Etsuro Fujita Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/08600ed3-3084-be70-65ba-279ab19618a5%40darold.net --- contrib/postgres_fdw/connection.c | 2 +- doc/src/sgml/postgres-fdw.sgml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c index 7cd69cc709..077eaf46ee 100644 --- a/contrib/postgres_fdw/connection.c +++ b/contrib/postgres_fdw/connection.c @@ -725,7 +725,7 @@ pgfdw_xact_callback(XactEvent event, void *arg) */ ereport(ERROR, (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; case XACT_EVENT_PARALLEL_COMMIT: case XACT_EVENT_COMMIT: diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index 634a7141ef..ed369cb54b 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -483,6 +483,12 @@ COMMITTED local transaction. A future PostgreSQL release might modify these rules. + + + Note that it is currently not supported by + postgres_fdw to prepare the remote transaction for + two-phase commit. + -- 2.19.2