postgresql/src
Tom Lane 326a33a289 Fix corner-case planner failure for MERGE.
MERGE planning could fail with "variable not found in subplan target
list" if the target table is partitioned and all its partitions are
excluded at plan time, or in the case where it has no partitions but
used to have some.  This happened because distribute_row_identity_vars
thought it didn't need to make the target table's reltarget list
fully valid; but if we generate a join plan then that is required
because the dummy Result node's tlist will be made from the reltarget.

The same logic appears in distribute_row_identity_vars in v14,
but AFAICS the problem is unreachable in that branch for lack of
MERGE.  In other updating statements, the target table is always
inner-joined to any other tables, so if the target is known dummy
then the whole plan reduces to dummy, so no join nodes are created.
So I'll refrain from back-patching this code change to v14 for now.

Per report from Alvaro Herrera.

Discussion: https://postgr.es/m/20230328112248.6as34mlx5sr4kltg@alvherre.pgsql
2023-03-28 11:39:24 -04:00
..
backend Fix corner-case planner failure for MERGE. 2023-03-28 11:39:24 -04:00
bin initdb: emit message when using default ICU locale. 2023-03-28 08:24:43 -07:00
common Make SCRAM iteration count configurable 2023-03-27 09:46:29 +02:00
fe_utils Revert refactoring of restore command code to shell_restore.c 2023-02-06 08:28:42 +09:00
include Save a few bytes in pg_attribute 2023-03-28 10:05:56 +02:00
interfaces Make SCRAM iteration count configurable 2023-03-27 09:46:29 +02:00
makefiles meson: Make auto the default of the ssl option 2023-03-13 07:04:11 +01:00
pl Add SysCacheGetAttrNotNull for guaranteed not-null attrs 2023-03-25 22:49:33 +01:00
port Use nanosleep() to implement pg_usleep(). 2023-03-15 17:57:12 +13:00
template Use unnamed POSIX semaphores on Cygwin. 2023-01-06 10:33:28 +13:00
test Fix corner-case planner failure for MERGE. 2023-03-28 11:39:24 -04:00
timezone Fix outdated references to guc.c 2023-03-02 13:49:39 +01:00
tools libpq: Add sslcertmode option to control client certificates 2023-03-24 13:34:26 +09:00
tutorial Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
.gitignore
DEVELOPERS
Makefile Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
Makefile.global.in autoconf: Move export_dynamic determination to configure 2022-12-06 18:55:28 -08:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build Integrate pg_bsd_indent into our build/test infrastructure. 2023-02-12 12:22:21 -05:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00