mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Since COPY fires triggers, it seems like a good idea for it to use
a frozen (copied) snapshot too. Move execMain's snapshot copying code out into a subroutine in case we find other places that need it.
This commit is contained in:
@ -27,7 +27,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.162 2002/05/21 22:05:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.163 2002/05/21 22:59:01 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -101,7 +101,6 @@ TupleDesc
|
||||
ExecutorStart(QueryDesc *queryDesc, EState *estate)
|
||||
{
|
||||
TupleDesc result;
|
||||
Snapshot es_snapshot;
|
||||
|
||||
/* sanity checks */
|
||||
Assert(queryDesc != NULL);
|
||||
@ -121,22 +120,7 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
|
||||
* for the life of this query, even if it outlives the current command
|
||||
* and current snapshot.
|
||||
*/
|
||||
if (QuerySnapshot == NULL) /* should be set already, but... */
|
||||
SetQuerySnapshot();
|
||||
|
||||
es_snapshot = (Snapshot) palloc(sizeof(SnapshotData));
|
||||
memcpy(es_snapshot, QuerySnapshot, sizeof(SnapshotData));
|
||||
if (es_snapshot->xcnt > 0)
|
||||
{
|
||||
es_snapshot->xip = (TransactionId *)
|
||||
palloc(es_snapshot->xcnt * sizeof(TransactionId));
|
||||
memcpy(es_snapshot->xip, QuerySnapshot->xip,
|
||||
es_snapshot->xcnt * sizeof(TransactionId));
|
||||
}
|
||||
else
|
||||
es_snapshot->xip = NULL;
|
||||
|
||||
estate->es_snapshot = es_snapshot;
|
||||
estate->es_snapshot = CopyQuerySnapshot();
|
||||
|
||||
/*
|
||||
* Initialize the plan
|
||||
|
Reference in New Issue
Block a user