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@postgresql.org
Subject: pgsql: Fix check_srf_call_placement() to handle VALUES cases correctly.
Date: Mon, 16 Jan 2017 20:23:20 +0000
Message-ID: <E1cTDoG-0002ko-V2@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix check_srf_call_placement() to handle VALUES cases correctly.

INSERT ... VALUES with a single VALUES row is implemented quite differently
from the general VALUES case.  A user-visible implication of that is that
we accept SRFs in the single-row case, but not in the multi-row case.
That's a historical artifact no doubt, but in view of the lack of field
complaints, I'm not excited about fixing it right now.

However, check_srf_call_placement() needs to know about this, first because
it should throw an error in the unsupported case, and second because it
should set p_hasTargetSRFs in the single-row case (because we treat that
like a SELECT tlist).  That's an oversight in commit a4c35ea1c.

To fix, split EXPR_KIND_VALUES into two values.  So far as I can see,
this is the only place where we need to distinguish the two cases at
present; but there might be more later.

Patch by me, per report from Andres Freund.

Discussion: https://postgr.es/m/20170116081548.zg63zltblwimpfgp@alap3.anarazel.de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/d43a619c60405ecda275ca9e3ac9ead242e20ecb

Modified Files
--------------
src/backend/parser/analyze.c       | 2 +-
src/backend/parser/parse_agg.c     | 2 ++
src/backend/parser/parse_expr.c    | 2 ++
src/backend/parser/parse_func.c    | 7 ++++++-
src/include/parser/parse_node.h    | 1 +
src/test/regress/expected/tsrf.out | 4 +++-
6 files changed, 15 insertions(+), 3 deletions(-)


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


Message-ID: <E1cTDoG-0002ko-V2@gemulon.postgresql.org>
Permalink:  ../E1cTDoG-0002ko-V2@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cTDoG-0002ko-V2@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: Fix check_srf_call_placement() to handle VALUES cases correctly.
  In-Reply-To: <E1cTDoG-0002ko-V2@gemulon.postgresql.org>
  References: <E1cTDoG-0002ko-V2@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