From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: In INSERT/UPDATE, use the table's real tuple descriptor as targe
Date: Mon, 26 Oct 2020 15:37:08 +0000
Message-ID: <E1kX4YW-00023N-1V@gemulon.postgresql.org> (raw)
In INSERT/UPDATE, use the table's real tuple descriptor as target.
Previously, ExecInitModifyTable relied on ExecInitJunkFilter,
and thence ExecCleanTypeFromTL, to build the target descriptor from
the query tlist. While we just checked (in ExecCheckPlanOutput)
that the tlist produces compatible output, this is not a great
substitute for the relation's actual tuple descriptor that's
available from the relcache. For one thing, dropped columns will
not be correctly marked attisdropped; it's a bit surprising that
we've gotten away with that this long. But the real reason for
being concerned with this is that using the table's descriptor means
that the slot will have correct attrmissing data, allowing us to
revert the klugy fix of commit ba9f18abd. (This commit undoes
that one's changes in trigger.c, but keeps the new test case.)
Thus we can solve the bogus-trigger-tuple problem with fewer cycles
rather than more.
No back-patch, since this doesn't fix any additional bug, and it
seems somewhat more likely to have unforeseen side effects than
ba9f18abd's narrow fix.
Discussion: https://postgr.es/m/16644-5da7ef98a7ac4545@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/20d3fe9009ddbbbb3da3a2da298f922054b43f8c
Modified Files
--------------
src/backend/commands/trigger.c | 38 +-----------------------------
src/backend/executor/execJunk.c | 42 +++++++++++++++++++++++++++-------
src/backend/executor/nodeModifyTable.c | 22 ++++++++++++++----
src/include/executor/executor.h | 3 +++
4 files changed, 55 insertions(+), 50 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: In INSERT/UPDATE, use the table's real tuple descriptor as targe
In-Reply-To: <E1kX4YW-00023N-1V@gemulon.postgresql.org>
References: <E1kX4YW-00023N-1V@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox