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: Code review for NextValueExpr expression node type.
Date: Fri, 14 Jul 2017 19:25:56 +0000
Message-ID: <E1dW6Ds-0006sQ-2o@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Code review for NextValueExpr expression node type.

Add missing infrastructure for this node type, notably in ruleutils.c where
its lack could demonstrably cause EXPLAIN to fail.  Add outfuncs/readfuncs
support.  (outfuncs support is useful today for debugging purposes.  The
readfuncs support may never be needed, since at present it would only
matter for parallel query and NextValueExpr should never appear in a
parallelizable query; but it seems like a bad idea to have a primnode type
that isn't fully supported here.)  Teach planner infrastructure that
NextValueExpr is a volatile, parallel-unsafe, non-leaky expression node
with cost cpu_operator_cost.  Given its limited scope of usage, there
*might* be no live bug today from the lack of that knowledge, but it's
certainly going to bite us on the rear someday.  Teach pg_stat_statements
about the new node type, too.

While at it, also teach cost_qual_eval() that MinMaxExpr, SQLValueFunction,
XmlExpr, and CoerceToDomain should be charged as cpu_operator_cost.
Failing to do this for SQLValueFunction was an oversight in my commit
0bb51aa96.  The others are longer-standing oversights, but no time like the
present to fix them.  (In principle, CoerceToDomain could have cost much
higher than this, but it doesn't presently seem worth trying to examine the
domain's constraints here.)

Modify execExprInterp.c to execute NextValueExpr as an out-of-line
function; it seems quite unlikely to me that it's worth insisting that
it be inlined in all expression eval methods.  Besides, providing the
out-of-line function doesn't stop anyone from inlining if they want to.

Adjust some places where NextValueExpr support had been inserted with the
aid of a dartboard rather than keeping it in the same order as elsewhere.

Discussion: https://postgr.es/m/23862.1499981661@sss.pgh.pa.us

Branch
------
master

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

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c |  8 +++++
src/backend/catalog/dependency.c                | 14 ++++----
src/backend/executor/execExprInterp.c           | 46 +++++++++++++++++--------
src/backend/nodes/nodeFuncs.c                   | 16 ++++-----
src/backend/nodes/outfuncs.c                    | 12 +++++++
src/backend/nodes/readfuncs.c                   | 16 +++++++++
src/backend/optimizer/path/costsize.c           |  9 +++++
src/backend/optimizer/util/clauses.c            | 23 ++++++++++++-
src/backend/utils/adt/ruleutils.c               | 17 +++++++++
src/include/executor/execExpr.h                 |  3 +-
src/include/nodes/nodes.h                       |  2 +-
src/include/nodes/primnodes.h                   | 28 +++++++--------
12 files changed, 147 insertions(+), 47 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: <E1dW6Ds-0006sQ-2o@gemulon.postgresql.org>
Permalink:  ../E1dW6Ds-0006sQ-2o@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dW6Ds-0006sQ-2o@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: Code review for NextValueExpr expression node type.
  In-Reply-To: <E1dW6Ds-0006sQ-2o@gemulon.postgresql.org>
  References: <E1dW6Ds-0006sQ-2o@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