David Johnston <david.g.johnston@gmail.com> writes:
> On Thu, Dec 18, 2014 at 1:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> That's why that isn't the example ;-). In this case, since the WHEN is a
>> constant, the constant-expression simplifier itself figures out that it
>> can throw away the THEN expression and replace the whole CASE with the
>> ELSE expression. So it doesn't bother const-simplifying the THEN, hence
>> no error.
> âIs the example with the "WITH" CTE too involved to use instead?â
Doesn't seem like it really adds anything.
>> Meh. The same principle applies in other languages too, so I don't think
>> your wording is an improvement.
> âYour's just didn't read that well to me...though the overall content was
> good. Maybe drop "Thus" and just lead with "Within PL/pgSQL functions, for
> example, using an IF [...]"
OK.
regards, tom lane