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: Don't split up SRFs when choosing to postpone SELECT output expr
Date: Fri, 25 Mar 2016 15:19:58 +0000
Message-ID: <E1ajTWo-0004zu-Ni@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Don't split up SRFs when choosing to postpone SELECT output expressions.

In commit 9118d03a8cca3d97 we taught the planner to postpone evaluation of
set-returning functions in a SELECT's targetlist until after any sort done
to satisfy ORDER BY.  However, if we postpone some SRFs this way while
others do not get postponed (because they're sort or group key columns)
we will break the traditional behavior by which all SRFs in the tlist run
in-step during ExecTargetList(), so that you get the least common multiple
of their periods not the product.  Fix make_sort_input_target() so it will
not split up SRF evaluation in such cases.

There is still a hazard of similar odd behavior if there's a SRF in a
grouping column and another one that isn't, but that was true before
and we're just trying to preserve bug-compatibility with the traditional
behavior.  This whole area is overdue to be rethought and reimplemented,
but we'll try to avoid changing behavior until then.

Per report from Regina Obe.

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/plan/planner.c | 48 ++++++++++++++++++++++++++----------
src/test/regress/expected/limit.out  | 38 ++++++++++++++++++++++++++++
src/test/regress/sql/limit.sql       | 13 ++++++++++
3 files changed, 86 insertions(+), 13 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: <E1ajTWo-0004zu-Ni@gemulon.postgresql.org>
Permalink:  ../E1ajTWo-0004zu-Ni@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ajTWo-0004zu-Ni@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: Don't split up SRFs when choosing to postpone SELECT output expr
  In-Reply-To: <E1ajTWo-0004zu-Ni@gemulon.postgresql.org>
  References: <E1ajTWo-0004zu-Ni@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