pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove buggy and dead code from CreateTriggerFiringOn
Date: Tue, 06 Sep 2022 03:52:29 +0000
Message-ID: <E1oVPdU-001eNB-Nq@gemulon.postgresql.org> (raw)

Remove buggy and dead code from CreateTriggerFiringOn

Here we remove some dead code from CreateTriggerFiringOn() which was
attempting to find the relevant child partition index corresponding to the
given indexOid.  As it turned out, thanks to -Wshadow=compatible-local,
this code was buggy as the code which was finding the child indexes
assigned those to a shadowed variable that directly went out of scope.
The code which thought it was looking at the List of child indexes was
always referencing an empty List.

On further investigation, this code is dead.  We never call
CreateTriggerFiringOn() passing a valid indexOid in a way that the
function would actually ever execute the code in question.  So, for lack
of a way to test if a fix actually works, let's just remove the dead code
instead.

As a reminder, if there is ever a need to resurrect this code, an Assert()
has been added to remind future feature developers that they might need to
write some code to find the corresponding child index.

Reported-by: Justin Pryzby
Reviewed-by: Justin Pryzby
Discussion: https://postgr.es/m/20220819211824.GX26426@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/16d69ec29b1199831c74504845f5d6117dbfc738

Modified Files
--------------
src/backend/commands/trigger.c | 44 +++++-------------------------------------
1 file changed, 5 insertions(+), 39 deletions(-)



Message-ID: <E1oVPdU-001eNB-Nq@gemulon.postgresql.org>
Permalink:  ../E1oVPdU-001eNB-Nq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oVPdU-001eNB-Nq@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: drowley@postgresql.org
  Subject: Re: pgsql: Remove buggy and dead code from CreateTriggerFiringOn
  In-Reply-To: <E1oVPdU-001eNB-Nq@gemulon.postgresql.org>
  References: <E1oVPdU-001eNB-Nq@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