postgresql/src/backend
Tom Lane 13921c5112 Fix misevaluation of STABLE parameters in CALL within plpgsql.
Before commit 84f5c2908, a STABLE function in a plpgsql CALL
statement's argument list would see an up-to-date snapshot,
because exec_stmt_call would push a new snapshot.  I got rid of
that because the possibility of the snapshot disappearing within
COMMIT made it too hard to manage a snapshot across the CALL
statement.  That's fine so far as the procedure itself goes,
but I forgot to think about the possibility of STABLE functions
within the CALL argument list.  As things now stand, those'll
be executed with the Portal's snapshot as ActiveSnapshot,
keeping them from seeing updates more recent than Portal startup.

(VOLATILE functions don't have a problem because they take their
own snapshots; which indeed is also why the procedure itself
doesn't have a problem.  There are no STABLE procedures.)

We can fix this by pushing a new snapshot transiently within
ExecuteCallStmt itself.  Popping the snapshot before we get
into the procedure proper eliminates the management problem.
The possibly-useless extra snapshot-grab is slightly annoying,
but it's no worse than what happened before 84f5c2908.

Per bug #17199 from Alexander Nawratil.  Back-patch to v11,
like the previous patch.

Discussion: https://postgr.es/m/17199-1ab2561f0d94af92@postgresql.org
2021-09-21 19:06:33 -04:00
..
access Further portability tweaks for float4/float8 hash functions. 2021-09-04 16:29:08 -04:00
bootstrap Revert "Skip WAL for new relfilenodes, under wal_level=minimal." 2020-03-22 09:24:13 -07:00
catalog Fix lookup error in extended stats ownership check 2021-08-31 18:42:11 +02:00
commands Fix misevaluation of STABLE parameters in CALL within plpgsql. 2021-09-21 19:06:33 -04:00
executor Report tuple address in data-corruption error message 2021-08-30 16:29:12 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit jit: Do not try to shut down LLVM state in case of LLVM triggered errors. 2021-09-13 18:26:18 -07:00
lib Fix typo in comment 2021-04-20 14:36:47 +02:00
libpq Set type identifier on BIO 2021-08-17 14:30:39 +02:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:28 -05:00
optimizer Fix mis-planning of repeated application of a projection. 2021-05-31 12:03:00 -04:00
parser Don't elide casting to typmod -1. 2021-09-20 11:48:52 -04:00
partitioning Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:24:51 +09:00
po Translation updates 2021-08-09 12:57:38 +02:00
port Make EXEC_BACKEND more convenient on macOS. 2021-08-13 11:10:49 +12:00
postmaster Revert "Avoid creating archive status ".ready" files too early" 2021-09-04 12:14:30 -04:00
regex Make pg_regexec() robust against out-of-range search_start. 2021-09-11 15:19:58 -04:00
replication Fix issue with WAL archiving in standby. 2021-09-09 23:59:19 +09:00
rewrite Fix rewriter to set hasModifyingCTE correctly on rewritten queries. 2021-09-08 12:05:43 -04:00
snowball Avoid unnecessary use of pg_strcasecmp for already-downcased identifiers. 2018-01-26 18:25:14 -05:00
statistics Use correct spelling of statistics kind 2021-03-23 04:56:17 +01:00
storage Fix variable shadowing in procarray.c. 2021-09-16 13:08:06 +09:00
tcop Fix some anomalies with NO SCROLL cursors. 2021-09-10 13:18:32 -04:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 21:44:43 -04:00
utils Fix bogus timetz_zone() results for DYNTZ abbreviations. 2021-09-06 11:29:52 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
nls.mk Translation updates 2018-09-17 08:40:36 +02:00