pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reject cases where a query in WITH rewrites to just NOTIFY.
Date: Fri, 09 Jul 2021 15:02:54 +0000
Message-ID: <E1m1s1m-00086i-05@gemulon.postgresql.org> (raw)

Reject cases where a query in WITH rewrites to just NOTIFY.

Since the executor can't cope with a utility statement appearing
as a node of a plan tree, we can't support cases where a rewrite
rule inserts a NOTIFY into an INSERT/UPDATE/DELETE command appearing
in a WITH clause of a larger query.  (One can imagine ways around
that, but it'd be a new feature not a bug fix, and so far there's
been no demand for it.)  RewriteQuery checked for this, but it
missed the case where the DML command rewrites to *only* a NOTIFY.
That'd lead to crashes later on in planning.  Add the missed check,
and improve the level of testing of this area.

Per bug #17094 from Yaoguang Chen.  It's been busted since WITH
was introduced, so back-patch to all supported branches.

Discussion: https://postgr.es/m/17094-bf15dff55eaf2e28@postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 20 +++++++++++++++++---
src/test/regress/expected/with.out   | 25 +++++++++++++++++++++++++
src/test/regress/sql/with.sql        | 21 +++++++++++++++++++++
3 files changed, 63 insertions(+), 3 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1m1s1m-00086i-05@gemulon.postgresql.org>
Permalink:  ../E1m1s1m-00086i-05@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m1s1m-00086i-05@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Reject cases where a query in WITH rewrites to just NOTIFY.
  In-Reply-To: <E1m1s1m-00086i-05@gemulon.postgresql.org>
  References: <E1m1s1m-00086i-05@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