Skip to content

Commit 6fa3d0a

Browse files
Jan WieckJan Wieck
authored andcommitted
One more fix to QuerySnapshot usage in ExecutorStart(). Maybe
current QuerySnapshot could be NULL. Jan
1 parent a5f3aba commit 6fa3d0a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/backend/executor/execMain.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.72 1999/02/07 13:37:55 wieck Exp $
29+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.73 1999/02/07 13:54:58 wieck Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -131,14 +131,19 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
131131
/*
132132
* Make our own private copy of the current queries snapshot data
133133
*/
134-
estate->es_snapshot = (Snapshot)palloc(sizeof(SnapshotData));
135-
memcpy(estate->es_snapshot, QuerySnapshot, sizeof(SnapshotData));
136-
if (estate->es_snapshot->xcnt > 0)
134+
if (QuerySnapshot == NULL)
135+
estate->es_snapshot = NULL
136+
else
137137
{
138-
estate->es_snapshot->xip = (TransactionId *)
138+
estate->es_snapshot = (Snapshot)palloc(sizeof(SnapshotData));
139+
memcpy(estate->es_snapshot, QuerySnapshot, sizeof(SnapshotData));
140+
if (estate->es_snapshot->xcnt > 0)
141+
{
142+
estate->es_snapshot->xip = (TransactionId *)
139143
palloc(estate->es_snapshot->xcnt * sizeof(TransactionId));
140-
memcpy(estate->es_snapshot->xip, QuerySnapshot->xip,
144+
memcpy(estate->es_snapshot->xip, QuerySnapshot->xip,
141145
estate->es_snapshot->xcnt * sizeof(TransactionId));
146+
}
142147
}
143148

144149
/*

0 commit comments

Comments
 (0)