summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorTom Lane2004-12-21 18:33:36 +0000
committerTom Lane2004-12-21 18:33:36 +0000
commit96b42de9a8f72fd42bc95abca820f7daaa4c7add (patch)
treefc503cfdd7ba530c6c762d42045d83ac0e21bd0e /src/pl
parentc21c658b3673d404ffc382e6ef63dcd6039d9c4e (diff)
exec_eval_simple_expr() needs to do CommandCounterIncrement() not just
GetTransactionSnapshot() to ensure ActiveSnapshot advances properly. Sigh. Extend regression test so it reveals this error too.
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plpgsql/src/pl_exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 5366cd1acf2..90dfc3c0d14 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.125 2004/12/19 20:20:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.126 2004/12/21 18:33:35 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -3631,7 +3631,7 @@ exec_eval_simple_expr(PLpgSQL_execstate *estate,
/*
* We have to do some of the things SPI_execute_plan would do,
- * in particular adjust ActiveSnapshot if we are in a non-read-only
+ * in particular advance the snapshot if we are in a non-read-only
* function. Without this, stable functions within the expression
* would fail to see updates made so far by our own function.
*/
@@ -3644,7 +3644,11 @@ exec_eval_simple_expr(PLpgSQL_execstate *estate,
oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
if (!estate->readonly_func)
+ {
+ CommandCounterIncrement();
ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
+ }
+
/*
* Finally we can call the executor to evaluate the expression
*/