pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@heroku.com>
Cc: Thomas Alton <thomas.alton@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Re: [BUGS] BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
Date: Mon, 23 May 2016 16:55:49 -0400
Message-ID: <22866.1464036949@sss.pgh.pa.us> (raw)
In-Reply-To: <CAM3SWZTwROYTfeJGA0W9=_3=hX_CP2U7fdpe_KnaJGRoxe3vVA@mail.gmail.com>
References: <20160521232802.22598.13537@wrigleys.postgresql.org>
	<CAM3SWZShRP+B29M81B=3-F68bYWSeSrpgpaZ_cOpA63XasicPQ@mail.gmail.com>
	<CAM3SWZTuzNykt0gz=mdG9e5hVXvBC-JocKfEuEbU7SvRKH8B6Q@mail.gmail.com>
	<18383.1464031327@sss.pgh.pa.us>
	<CAM3SWZSWjLPn+_T1A_WKZnRe_pcG+KQ7fk8ZFZ1jyJZk0SrjhA@mail.gmail.com>
	<20096.1464032918@sss.pgh.pa.us>
	<CAM3SWZTwROYTfeJGA0W9=_3=hX_CP2U7fdpe_KnaJGRoxe3vVA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Peter Geoghegan <pg@heroku.com> writes:
> On Mon, May 23, 2016 at 12:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Also, related to this complaint though not this patch, it's disturbing
>> that this oversight wasn't detected long ago.  My first thought was to add
>> some conditionally-compiled debugging code that just performs a no-op
>> traverse of every raw parse tree produced by the grammar.  However that
>> doesn't work because raw_expression_tree_walker doesn't promise to support
>> everything, only DML statements.  Thoughts?

> Why couldn't the debug code be executed conditionally, too? Since
> raw_expression_tree_walker() promises to work for "SelectStmt and
> everything that could appear under it", I don't think it would be
> difficult to find a choke point for that. Perhaps there is some
> subtlety I've missed, since what I propose seems too obvious. FWIW, I
> don't think it would much matter if this debug code was not reliably
> executed for every possible SelectStmt. Just limiting it to top-level
> SelectStmts would have easily caught this bug.

Um, I think not --- you need the case cited by the OP, namely an INSERT
ON CONFLICT in a CTE in a SelectStmt.  If we'd had any of those in the
regression tests, we'd have found the bug, but we don't; and it's not
an obvious combination to try.  We would have found it if there were
a reason to run raw_expression_tree_walker() on bare InsertStmts,
but currently there is not.

Possibly we could get adequate coverage by inserting the debug code
into the first four switch cases in transformStmt().

If that sounds like a plausible choke-point, the next question is what
to use to enable the debug test.  I propose "#ifdef COPY_PARSE_PLAN_TREES"
since that enables similar sanity checking for other parts of
backend/nodes/, and we do have at least one buildfarm member using it.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (14+ messages)  latest in thread

Message-ID: <22866.1464036949@sss.pgh.pa.us>
Permalink:  ../22866.1464036949@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22866.1464036949@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@heroku.com, thomas.alton@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: [BUGS] BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
  In-Reply-To: <22866.1464036949@sss.pgh.pa.us>
  References: <20160521232802.22598.13537@wrigleys.postgresql.org> <CAM3SWZShRP+B29M81B=3-F68bYWSeSrpgpaZ_cOpA63XasicPQ@mail.gmail.com> <CAM3SWZTuzNykt0gz=mdG9e5hVXvBC-JocKfEuEbU7SvRKH8B6Q@mail.gmail.com> <18383.1464031327@sss.pgh.pa.us> <CAM3SWZSWjLPn+_T1A_WKZnRe_pcG+KQ7fk8ZFZ1jyJZk0SrjhA@mail.gmail.com> <20096.1464032918@sss.pgh.pa.us> <CAM3SWZTwROYTfeJGA0W9=_3=hX_CP2U7fdpe_KnaJGRoxe3vVA@mail.gmail.com> <22866.1464036949@sss.pgh.pa.us>

* 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