postgres - CASE evaluates subexpression that is not needed todetermine the result

Поиск
Список
Период
Сортировка
От Kamenoqd Zelen
Тема postgres - CASE evaluates subexpression that is not needed todetermine the result
Дата
Msg-id CAJVAX4iRStCBv6wziJVDPOy6-fnhdALuxRnXodkBYenEN4m+Pw@mail.gmail.com
обсуждение исходный текст
Ответы Re: postgres - CASE evaluates subexpression that is not needed todetermine the result  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: postgres - CASE evaluates subexpression that is not needed to determine the result  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Hello,
I have the following 3 examples of case expressions in postgres, which I would expect to evaluate in the same way. However the first and the third give ERROR: invalid input syntax for integer: "2017.7". The second one returns true. Why is the difference?

Postgres documentation states:

"A CASE expression does not evaluate any subexpressions that are not needed to determine the result."

select case when 0 = 0 then 1 < 2

        when 0 = 2 then 2000 = ('2017.7')::bigint

    end;


select case when 0 = 0 then 1 < 2

        when 0 = 2 then 2000 = ('2017.7'||'')::bigint 

    end;


select case when (array[1,2])[1] =1 then 1 < 2

        when (array[1,2])[1] = 2 then 2000 = ('2017.7'||'')::bigint 

    end;

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: BUG #15486: PG11 jit on 50x slower than jit off
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: postgres - CASE evaluates subexpression that is not needed todetermine the result