|
7 | 7 | * Portions Copyright (c) 1994, Regents of the University of California |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.175 2004/11/14 02:04:14 neilc Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.176 2004/12/06 23:57:17 tgl Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -2364,6 +2364,14 @@ AfterTriggerEndXact(void) |
2364 | 2364 | /* ... but not inside a query */ |
2365 | 2365 | Assert(afterTriggers->query_depth==-1); |
2366 | 2366 |
|
| 2367 | +/* |
| 2368 | + * If there are any triggers to fire, make sure we have set a snapshot |
| 2369 | + * for them to use. (Since PortalRunUtility doesn't set a snap for |
| 2370 | + * COMMIT, we can't assume ActiveSnapshot is valid on entry.) |
| 2371 | + */ |
| 2372 | +if (afterTriggers->events.head!=NULL) |
| 2373 | +ActiveSnapshot=CopySnapshot(GetTransactionSnapshot()); |
| 2374 | + |
2367 | 2375 | /* |
2368 | 2376 | * Run all the remaining triggers. Loop until they are all gone, |
2369 | 2377 | * just in case some trigger queues more for us to do. |
|