pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up code to resolve the "root target relation" in nodeModif
Date: Mon, 19 Oct 2020 11:43:59 +0000
Message-ID: <E1kUTa3-0000Oo-8r@gemulon.postgresql.org> (raw)

Clean up code to resolve the "root target relation" in nodeModifyTable.c

When executing DDL on a partitioned table or on a table with inheritance
children, statement-level triggers must be fired against the table given
in the original statement. The code to look that up was a bit messy and
duplicative. Commit 501ed02cf6 added a helper function,
getASTriggerResultRelInfo() (later renamed to getTargetResultRelInfo())
for it, but for some reason it was only used when firing AFTER STATEMENT
triggers and the code to fire BEFORE STATEMENT triggers duplicated the
logic.

Determine the target relation in ExecInitModifyTable(), and set it always
in ModifyTableState. Code that used to call getTargetResultRelInfo() can
now use ModifyTableState->rootResultRelInfo directly.

Discussion: https://www.postgresql.org/message-id/CA%2BHiwqFViT47Zbr_ASBejiK7iDG8%3DQ1swQ-tjM6caRPQ67pT%3Dw%40ma...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f49b85d783f6781138f33bbe5f6e98da86907d84

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 62 +++++++++++++---------------------
src/include/nodes/execnodes.h          |  9 +++--
2 files changed, 31 insertions(+), 40 deletions(-)



Message-ID: <E1kUTa3-0000Oo-8r@gemulon.postgresql.org>
Permalink:  ../E1kUTa3-0000Oo-8r@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kUTa3-0000Oo-8r@gemulon.postgresql.org

 · 

reply

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: heikki.linnakangas@iki.fi
  Subject: Re: pgsql: Clean up code to resolve the "root target relation" in nodeModif
  In-Reply-To: <E1kUTa3-0000Oo-8r@gemulon.postgresql.org>
  References: <E1kUTa3-0000Oo-8r@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