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: Be more careful about printing constants in ruleutils.c.
Date: Mon, 30 Mar 2015 18:59:55 +0000
Message-ID: <E1Yceuh-0008PI-6p@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Be more careful about printing constants in ruleutils.c.

The previous coding in get_const_expr() tried to avoid quoting integer,
float, and numeric literals if at all possible.  While that looks nice,
it means that dumped expressions might re-parse to something that's
semantically equivalent but not the exact same parsetree; for example
a FLOAT8 constant would re-parse as a NUMERIC constant with a cast to
FLOAT8.  Though the result would be the same after constant-folding,
this is problematic in certain contexts.  In particular, Jeff Davis
pointed out that this could cause unexpected failures in ALTER INHERIT
operations because of child tables having not-exactly-equivalent CHECK
expressions.  Therefore, favor correctness over legibility and dump
such constants in quotes except in the limited cases where they'll
be interpreted as the same type even without any casting.

This results in assorted small changes in the regression test outputs,
and will affect display of user-defined views and rules similarly.
The odds of that causing problems in the field seem non-negligible;
given the lack of previous complaints, it seems best not to change
this in the back branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/542320c2bd0b3796a8a9a4617cdb23fbad473390

Modified Files
--------------
contrib/btree_gist/expected/float4.out         |    2 +-
contrib/btree_gist/expected/float8.out         |    2 +-
contrib/btree_gist/expected/int2.out           |    2 +-
contrib/btree_gist/expected/int8.out           |    6 +-
contrib/btree_gist/expected/numeric.out        |    6 +-
contrib/postgres_fdw/expected/postgres_fdw.out |    2 +-
src/backend/utils/adt/ruleutils.c              |   91 ++++++++++++++----------
src/test/regress/expected/equivclass.out       |   44 ++++++------
src/test/regress/expected/join.out             |   42 +++++------
src/test/regress/expected/rowtypes.out         |    6 +-
src/test/regress/expected/union.out            |    6 +-
src/test/regress/expected/with.out             |    6 +-
12 files changed, 114 insertions(+), 101 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: <E1Yceuh-0008PI-6p@gemulon.postgresql.org>
Permalink:  ../E1Yceuh-0008PI-6p@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1Yceuh-0008PI-6p@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: Be more careful about printing constants in ruleutils.c.
  In-Reply-To: <E1Yceuh-0008PI-6p@gemulon.postgresql.org>
  References: <E1Yceuh-0008PI-6p@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