postgresql/src/test/regress
Tom Lane 6548d62a98 Repair bogus handling of multi-assignment Params in upper plan levels.
Our support for multiple-set-clauses in UPDATE assumes that the Params
referencing a MULTIEXPR_SUBLINK SubPlan will appear before that SubPlan
in the targetlist of the plan node that calculates the updated row.
(Yeah, it's a hack...)  In some PG branches it's possible that a Result
node gets inserted between the primary calculation of the update tlist
and the ModifyTable node.  setrefs.c did the wrong thing in this case
and left the upper-level Params as Params, causing a crash at runtime.
What it should do is replace them with "outer" Vars referencing the child
plan node's output.  That's a result of careless ordering of operations
in fix_upper_expr_mutator, so we can fix it just by reordering the code.

Fix fix_join_expr_mutator similarly for consistency, even though join
nodes could never appear in such a context.  (In general, it seems
likely to be a bit cheaper to use Vars than Params in such situations
anyway, so this patch might offer a tiny performance improvement.)

The hazard extends back to 9.5 where the MULTIEXPR_SUBLINK stuff
was introduced, so back-patch that far.  However, this may be a live
bug only in 9.6.x and 10.x, as the other branches don't seem to want
to calculate the final tlist below the Result node.  (That plan shape
change between branches might be a mini-bug in itself, but I'm not
really interested in digging into the reasons for that right now.
Still, add a regression test memorializing what we expect there,
so we'll notice if it changes again.)

Per bug report from Eduards Bezverhijs.

Discussion: https://postgr.es/m/b6cd572a-3e44-8785-75e9-c512a5a17a73@tieto.com
2018-12-12 13:49:42 -05:00
..
data Improve key representation for GIN jsonb_ops, and fix existence-search bug. 2014-05-09 08:41:26 -04:00
expected Repair bogus handling of multi-assignment Params in upper plan levels. 2018-12-12 13:49:42 -05:00
input Remove regression tests' CREATE FUNCTION commands for unused C functions. 2018-02-27 15:04:48 -05:00
output Remove regression tests' CREATE FUNCTION commands for unused C functions. 2018-02-27 15:04:48 -05:00
sql Repair bogus handling of multi-assignment Params in upper plan levels. 2018-12-12 13:49:42 -05:00
.gitignore Update .gitignore for config.cache. 2014-12-18 19:56:42 +09:00
GNUmakefile Add a temp-install prerequisite to "check"-like targets not having one. 2017-11-05 18:54:52 -08:00
Makefile Fix non-GNU makefiles for AIX make. 2017-11-30 00:57:31 -08:00
parallel_schedule Merge large_object.sql test into largeobject.source. 2017-07-17 15:28:17 -04:00
pg_regress.c Lower privilege level of programs calling regression_main 2018-10-20 09:11:18 -04:00
pg_regress.h Improve speed of make check-world 2015-04-23 08:59:52 -04:00
pg_regress_main.c Clean up assorted misuses of snprintf()'s result value. 2018-08-15 16:29:32 -04:00
README Don't generate plain-text HISTORY and src/test/regress/README anymore. 2014-02-10 20:48:04 -05:00
regress.c Fix and improve pg_atomic_flag fallback implementation. 2018-04-06 20:02:12 -07:00
regressplans.sh Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
resultmap Enable compiling with the mingw-w64 32 bit compiler. 2011-12-10 15:35:41 -05:00
serial_schedule Merge large_object.sql test into largeobject.source. 2017-07-17 15:28:17 -04:00
standby_schedule Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00

Documentation concerning how to run these regression tests and interpret
the results can be found in the PostgreSQL manual, in the chapter
"Regression Tests".