From: Justin Pryzby <pryzby@telsasoft.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-hackers@postgresql.org, Tomas Vondra <tomas.vondra@postgresql.org>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: Re: FOR EACH ROW triggers, on partitioend tables, with indexes?
Date: Thu, 1 Sep 2022 00:31:46 -0500
Message-ID: <20220901053146.GI31833@telsasoft.com> (raw)
In-Reply-To: <CAApHDvr9oet_oSu6FcybJ3M96Xrwms6p+o11UBYMuaeBYBL1-g@mail.gmail.com>
References: <20220819211824.GX26426@telsasoft.com>
<CAApHDvr9oet_oSu6FcybJ3M96Xrwms6p+o11UBYMuaeBYBL1-g@mail.gmail.com>
On Thu, Sep 01, 2022 at 04:19:37PM +1200, David Rowley wrote:
> On Sat, 20 Aug 2022 at 09:18, Justin Pryzby <pryzby@telsasoft.com> wrote:
> > Is it somwhow possible to call CreateTrigger() to create a FOR EACH ROW
> > trigger, with an index, and not internally ?
>
> I've been looking over this and I very much agree that the code looks
> very broken. As for whether this is dead code or not, I've been
> looking at that too...
>
> At trigger.c:1147 we have: if (partition_recurse). partition_recurse
> can only ever be true if isInternal == false per trigger.c:367's
> "partition_recurse = !isInternal && stmt->row &&". isInternal is a
> parameter to the function. Also, the code in question only triggers
> when the indexOid parameter is a valid oid. So it should just be a
> matter of looking for usages of CreateTriggerFiringOn() which pass
> isInternal as false and pass a valid indexOid.
>
> There seems to be no direct calls doing this, but we do also call this
> function via CreateTrigger() and I can see only 1 call to
> CreateTrigger() that passes isInternal as false, but that explicitly
> passes indexOid as InvalidOid, so this code looks very much dead to
> me.
>
> Alvaro, any objections to just ripping this out? aka, the attached.
It's possible that extensions or 3rd party code or forks use this, no ?
In that case, it might be "not dead" ..
> + * that ever changes then we'll need to quite code here to find the
quite? write? quire? acquire? quine?
--
Justin
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-hackers@postgresql.org
Cc: pryzby@telsasoft.com, dgrowleyml@gmail.com, tomas.vondra@postgresql.org, smithpb2250@gmail.com, alvherre@alvh.no-ip.org
Subject: Re: FOR EACH ROW triggers, on partitioend tables, with indexes?
In-Reply-To: <20220901053146.GI31833@telsasoft.com>
References: <20220819211824.GX26426@telsasoft.com> <CAApHDvr9oet_oSu6FcybJ3M96Xrwms6p+o11UBYMuaeBYBL1-g@mail.gmail.com> <20220901053146.GI31833@telsasoft.com>
* 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