summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2017-08-02 14:59:01 +0000
committerPeter Eisentraut2017-08-02 15:34:42 +0000
commitcf652018332819716b10c9de9ce80c81284d6815 (patch)
treeb25c5796590c226627c543d742a1bead59f06c43
parentf352f91cbf2f662c4f043d3650010b02da0cde1c (diff)
Get a snapshot before COPY in table sync
This fixes a crash if the local table has a function index and the function makes non-immutable calls. Reported-by: Scott Milliken <[email protected]> Author: Masahiko Sawada <[email protected]>
-rw-r--r--src/backend/replication/logical/tablesync.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 32abf5b368..4cca0f1a85 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -917,7 +917,9 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
walrcv_create_slot(wrconn, slotname, true,
CRS_USE_SNAPSHOT, origin_startpos);
+ PushActiveSnapshot(GetTransactionSnapshot());
copy_table(rel);
+ PopActiveSnapshot();
res = walrcv_exec(wrconn, "COMMIT", 0, NULL);
if (res->status != WALRCV_OK_COMMAND)