Re: CASE Statement - Order of expression processing
От | Albe Laurenz |
---|---|
Тема | Re: CASE Statement - Order of expression processing |
Дата | |
Msg-id | A737B7A37273E048B164557ADEF4A58B17BC1412@ntex2010a.host.magwien.gv.at обсуждение исходный текст |
Ответ на | Re: CASE Statement - Order of expression processing (Stefan Drees <stefan@drees.name>) |
Список | pgsql-general |
>> But in the following expression: >> >> template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/0 END; >> ERROR: division by zero >> >> (Just to be sure, a "SELECT (SELECT 0)=0;" returns true) >> >> It seems that when the "CASE WHEN expression" is a query, the evaluation >> order changes. >> According to the documentation, this behaviour is wrong. Just to keep you updated: We have updated the documentation to alert people to this behaviour: http://www.postgresql.org/docs/devel/static/functions-conditional.html#FUNCTIONS-CASE There were considerations to change the behaviour, but that would mean that query execution time suffers in many cases. It was decided that the problem occurs only in rather artificial queries, and that it would not be worth changing the normally useful behaviour of constant folding during query planning. Yours, Laurenz Albe
В списке pgsql-general по дате отправления: