From: Stephen Frost <sfrost@snowman.net>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: Incorrect processing of CREATE TRANSFORM with DDL deparding
Date: Mon, 25 May 2015 22:02:43 -0400
Message-ID: <20150526020243.GU26667@tamriel.snowman.net> (raw)
In-Reply-To: <CAB7nPqR3oeggsoVqKrgvoS=mJCfH1qMbFHjCGj2RVLu0Nf7Sjg@mail.gmail.com>
References: <CAB7nPqQNS36enM2R=6P9FvKUu7t3k=2EjFkFBPnby==pLFqQ+w@mail.gmail.com>
<20150525155248.GG5885@postgresql.org>
<CAB7nPqR3oeggsoVqKrgvoS=mJCfH1qMbFHjCGj2RVLu0Nf7Sjg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
* Michael Paquier (michael.paquier@gmail.com) wrote:
> On Tue, May 26, 2015 at 12:52 AM, Alvaro Herrera wrote:
> > Michael Paquier wrote:
> >> In ProcessUtilitySlow()@utility.c, for a node T_CreateTransformStmt,
> >> process does not return ObjectAddress. This makes process inconsistent
> >> with the other commands and the ObjectAddress passed to
> >> EventTriggerCollectSimpleCommand is not initialized.
> >> Coverity has pointed out the error, I just some legwork to sort out a fix.
> >
> > Yeah, I had noticed this and was pretty annoyed because we ended up in
> > precisely the situation we didn't want to be: new code is added to
> > ProcessUtility that is not handled by the deparse framework. (I
> > don't know whether TRANSFORM went in first or deparse, but it doesn't
> > really matter.)
> >
> > The fix as you say is pretty trivial, but I would like to use this is a
> > test case to ensure that we will catch all these mistakes in the future
> > too not only this particular one.
>
> I guess that you could add an assertion at the bottom of
> ProcessUtilitySlow() as well to check code paths where ObjectAddress
> is not initialized correctly.
I seem to recall that being in one of the variations of this patch and I
tend to agree that it makes sense...
That said, I'm really not all that happy with the split between
ProcessUtility() and ProcessUtilitySlow(). I've not said anything since
I haven't got any great solutions to the issue, but it really is pretty
grotty. I realize it might take a few extra cycles, but my thinking is
along the lines of having an array or similar which we scan that
indicates what is supported by deparse/event triggers, what isn't, etc,
and then we operate based on that.. Perhaps an array which is indexed
based on the NodeTag enum? I realize that'd be a stupidly large array,
of, I dunno, 8k or more, but it'd surely make ProcessUtility a heck of a
lot shorter/simpler..
Considering the line count between the two is over 1000, perhaps it'd be
a net savings in size, if not speed.
Just a few off-the-cuff thoughts.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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-bugs@postgresql.org
Cc: sfrost@snowman.net, michael.paquier@gmail.com, alvherre@2ndquadrant.com
Subject: Re: Incorrect processing of CREATE TRANSFORM with DDL deparding
In-Reply-To: <20150526020243.GU26667@tamriel.snowman.net>
References: <CAB7nPqQNS36enM2R=6P9FvKUu7t3k=2EjFkFBPnby==pLFqQ+w@mail.gmail.com> <20150525155248.GG5885@postgresql.org> <CAB7nPqR3oeggsoVqKrgvoS=mJCfH1qMbFHjCGj2RVLu0Nf7Sjg@mail.gmail.com> <20150526020243.GU26667@tamriel.snowman.net>
* 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