postgresql/src/backend
Tom Lane d88d8ad284 Fix corner case for a BEFORE ROW UPDATE trigger returning OLD.
If the old row has any "missing" attributes that are supposed to
be retrieved from an associated tuple descriptor, the wrong things
happened because the trigger result is shoved directly into an
executor slot that lacks the missing-attribute data.  Notably,
CHECK-constraint verification would incorrectly see those columns
as NULL, and so would RETURNING-list evaluation.

Band-aid around this by forcibly expanding the tuple before passing
it to the trigger function.  (IMO it was a fundamental misdesign to
put the missing-attribute data into tuple constraints, which so
much of the system considers to be optional.  But we're probably
stuck with that now, and will have to continue to apply band-aids
as we find other places with similar issues.)

Back-patch to v12.  v11 would also have the issue, except that
commit 920311ab1 already applied a similar band-aid.  That forced
expansion in more cases than seem really necessary, though, so
this isn't a directly equivalent fix.

Amit Langote, with some cosmetic changes by me

Discussion: https://postgr.es/m/16644-5da7ef98a7ac4545@postgresql.org
2020-10-25 13:57:46 -04:00
..
access Fix GiST buffering build to work when there are included columns. 2020-10-12 18:01:34 -04:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Fix list-munging bug that broke SQL function result coercions. 2020-10-19 14:33:10 -04:00
commands Fix corner case for a BEFORE ROW UPDATE trigger returning OLD. 2020-10-25 13:57:46 -04:00
executor Fix list-munging bug that broke SQL function result coercions. 2020-10-19 14:33:10 -04:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit llvmjit: Work around bug in LLVM 3.9 causing crashes after 72559438f9. 2020-10-15 18:17:00 -07:00
lib Use pg_bitutils for HyperLogLog. 2020-07-30 09:17:00 -07:00
libpq Message fixes and style improvements 2020-09-14 06:42:07 +02:00
main Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nodes Add for_each_from, to simplify loops starting from non-first list cells. 2020-09-28 20:32:53 -04:00
optimizer Fix list-munging bug that broke SQL function result coercions. 2020-10-19 14:33:10 -04:00
parser Fix optimization hazard in gram.y's makeOrderedSetArgs(), redux. 2020-10-07 18:42:02 -04:00
partitioning Clean up some code and comments in partbounds.c. 2020-09-10 18:00:01 +09:00
po Translation updates 2020-09-21 10:06:30 +02:00
port Spelling adjustments 2020-06-07 15:06:51 +02:00
postmaster Use _exit(2) for SIGQUIT during ProcessStartupPacket, too. 2020-09-10 12:06:26 -04:00
regex Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00
replication Restore replication protocol's duplicate command tags 2020-10-14 20:12:26 -03:00
rewrite Add missing invocations to object access hooks 2020-05-23 14:03:04 +09:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Run pgindent with new pg_bsd_indent version 2.1.1. 2020-05-16 11:54:51 -04:00
storage Avoid invalid alloc size error in shm_mq 2020-10-20 14:09:16 +02:00
tcop Fix bogus completion tag usage in walsender 2020-09-16 21:16:25 -03:00
tsearch Avoid possible dangling-pointer access in tsearch_readline_callback. 2020-09-23 11:36:13 -04:00
utils Fix incorrect parameter name in a function header comment 2020-10-25 22:40:58 +13: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 Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2020-09-14 13:14:53 +02:00