postgresql/src/include
Tom Lane 41c6f9db25 Repair more failures with SubPlans in multi-row VALUES lists.
Commit 9b63c13f0 turns out to have been fundamentally misguided:
the parent node's subPlan list is by no means the only way in which
a child SubPlan node can be hooked into the outer execution state.
As shown in bug #16213 from Matt Jibson, we can also get short-lived
tuple table slots added to the outer es_tupleTable list.  At this point
I have little faith that there aren't other possible connections as
well; the long time it took to notice this problem shows that this
isn't a heavily-exercised situation.

Therefore, revert that fix, returning to the coding that passed a
NULL parent plan pointer down to the transiently-built subexpressions.
That gives us a pretty good guarantee that they won't hook into the
outer executor state in any way.  But then we need some other solution
to make SubPlans work.  Adopt the solution speculated about in the
previous commit's log message: do expression initialization at plan
startup for just those VALUES rows containing SubPlans, abandoning the
goal of reclaiming memory intra-query for those rows.  In practice it
seems unlikely that queries containing a vast number of VALUES rows
would be using SubPlans in them, so this should not give up much.

(BTW, this test case also refutes my claim in connection with the prior
commit that the issue only arises with use of LATERAL.  That was just
wrong: some variants of SubLink always produce SubPlans.)

As with previous patch, back-patch to all supported branches.

Discussion: https://postgr.es/m/16213-871ac3bc208ecf23@postgresql.org
2020-01-17 16:17:31 -05:00
..
access Introduce IndexAM fields for parallel vacuum. 2020-01-15 07:24:14 +05:30
bootstrap Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catalog bump catalog version as should have been done for jsonb_set_lax 2020-01-17 16:24:13 +10:30
commands Restructure ALTER TABLE execution to fix assorted bugs. 2020-01-15 18:49:24 -05:00
common Move OpenSSL routines for min/max protocol setting to src/common/ 2020-01-17 10:06:17 +09:00
datatype Update copyrights for 2020 2020-01-01 12:21:45 -05:00
executor Improve the handling of result type coercions in SQL functions. 2020-01-08 11:07:59 -05:00
fe_utils Reduce size of backend scanner's tables. 2020-01-13 15:04:31 -05:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lib Skip memcpy(x, x) in qunique(). 2020-01-04 11:31:42 -08:00
libpq Update copyrights for 2020 2020-01-01 12:21:45 -05:00
mb Rationalize code placement between wchar.c, encnames.c, and mbutils.c. 2020-01-16 18:08:21 -05:00
nodes Repair more failures with SubPlans in multi-row VALUES lists. 2020-01-17 16:17:31 -05:00
optimizer Update copyrights for 2020 2020-01-01 12:21:45 -05:00
parser Restructure ALTER TABLE execution to fix assorted bugs. 2020-01-15 18:49:24 -05:00
partitioning Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port Update copyrights for 2020 2020-01-01 12:21:45 -05:00
portability Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postmaster Update copyrights for 2020 2020-01-01 12:21:45 -05:00
regex Update copyrights for 2020 2020-01-01 12:21:45 -05:00
replication Set ReorderBufferTXN->final_lsn more eagerly 2020-01-17 18:00:39 -03:00
rewrite Update copyrights for 2020 2020-01-01 12:21:45 -05:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Update copyrights for 2020 2020-01-01 12:21:45 -05:00
storage Remove STATUS_FOUND 2020-01-11 07:48:57 +01:00
tcop Fix problems with "read only query" checks, and refactor the code. 2020-01-16 12:11:31 -05:00
tsearch Update copyrights for 2020 2020-01-01 12:21:45 -05:00
utils Report progress of ANALYZE commands 2020-01-15 11:14:39 -03:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Remove STATUS_FOUND 2020-01-11 07:48:57 +01:00
fmgr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
funcapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
getaddrinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
getopt_long.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
miscadmin.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_config.h.in Fix handling of OpenSSL's SSL_clear_options 2019-12-06 15:13:55 +09:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_getopt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_trace.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgstat.h Report progress of ANALYZE commands 2020-01-15 11:14:39 -03:00
pgtar.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgtime.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rusagestub.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
windowapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00