Re: BUG #12273: CASE Expression BUG

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #12273: CASE Expression BUG
Дата
Msg-id 17992.1418922882@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #12273: CASE Expression BUG  (David G Johnston <david.g.johnston@gmail.com>)
Ответы Re: BUG #12273: CASE Expression BUG
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: David G Johnston
Дата:
Сообщение: Re: BUG #12273: CASE Expression BUG
Следующее
От: David Johnston
Дата:
Сообщение: Re: BUG #12273: CASE Expression BUG