From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12273: CASE Expression BUG
Date: Thu, 18 Dec 2014 12:14:42 -0500
Message-ID: <17992.1418922882@sss.pgh.pa.us> (raw)
In-Reply-To: <1418921627518-5831325.post@n5.nabble.com>
References: <20141218144436.1237.96696@wrigleys.postgresql.org>
<16630.1418918898@sss.pgh.pa.us>
<1418921627518-5831325.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
David G Johnston <david.g.johnston@gmail.com> writes:
> Tom Lane-2 wrote
>> We're unlikely to change this, because it would cripple optimization
>> attempts. The fact that const-simplification doesn't happen in the other
>> way you wrote the function is not more-correct behavior, it's just an
>> implementation artifact that you shouldn't rely on. What you need to do
>> is code this as an if-then-else sequence, not CASE, so that you don't
>> attempt to evaluate any expressions with undefined constant
>> subexpressions.
> Note that this is documented here:
> http://www.postgresql.org/docs/9.4/interactive/functions-conditional.html#FUNCTIONS-CASE
> Specifically, the "Note" at the end of 9.17.1
Hmm ... I'd just been looking at 4.2.14:
http://www.postgresql.org/docs/9.4/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL
and thinking that maybe it should mention this. Perhaps we ought to
relocate the text about constant subexpressions into 4.2.14 (and add an
example), and then link there from 9.17.1.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com
Subject: Re: BUG #12273: CASE Expression BUG
In-Reply-To: <17992.1418922882@sss.pgh.pa.us>
References: <20141218144436.1237.96696@wrigleys.postgresql.org> <16630.1418918898@sss.pgh.pa.us> <1418921627518-5831325.post@n5.nabble.com> <17992.1418922882@sss.pgh.pa.us>
* 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