diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-21 22:59:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-21 22:59:01 +0000 |
commit | 6c6f395a8aca8a9525d62cbf46fbafd130bdb9e5 (patch) | |
tree | 3441e3fff093efdb62b2ef19cac4371fe248c241 /src/backend/executor/execMain.c | |
parent | 26fcd25c57cd56cd42f1cec73ede1198d1ca941b (diff) | |
download | postgresql-6c6f395a8aca8a9525d62cbf46fbafd130bdb9e5.tar.gz postgresql-6c6f395a8aca8a9525d62cbf46fbafd130bdb9e5.zip |
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.
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index a8c776bab2c..29687a54baa 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -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 |