From f94d9a7f0d1613c2c589d80f23806a0d31ce3c0b Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 3 Aug 2016 10:01:25 +0300 Subject: [PATCH] Fix snapshot handling when dealing with bind parameters. There was some code left over from the 8.3 merge, that prematurely reset ActiveSnapshot. Remove the extraneous code. Fixes github issue #1001. Thank you @clmyyclm for the report! --- src/backend/tcop/postgres.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 5acb0b9e3b..780cc73830 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2202,7 +2202,6 @@ exec_bind_message(StringInfo input_message) Snapshot mySnapshot = NULL; char msec_str[32]; - /* Get the fixed part of the message */ portal_name = pq_getmsgstring(input_message); stmt_name = pq_getmsgstring(input_message); @@ -2342,15 +2341,7 @@ exec_bind_message(StringInfo input_message) */ if (numParams > 0) { - Snapshot mySnapshot; int paramno; - - /* - * Set a snapshot if we have parameters to fetch (since the input - * functions might need it). - */ - mySnapshot = CopySnapshot(GetTransactionSnapshot()); - ActiveSnapshot = mySnapshot; /* sizeof(ParamListInfoData) includes the first array element */ params = (ParamListInfo) palloc(sizeof(ParamListInfoData) + @@ -2476,12 +2467,6 @@ exec_bind_message(StringInfo input_message) params->params[paramno].pflags = PARAM_FLAG_CONST; params->params[paramno].ptype = ptype; } - - MemoryContextSwitchTo(oldContext); - - /* Done with the snapshot used for parameter I/O */ - ActiveSnapshot = NULL; - FreeSnapshot(mySnapshot); } else params = NULL; -- GitLab