BUG #11661: CASE ELSE is evaluated although condition is true

Поиск
Список
Период
Сортировка
От michael@aplaypowered.com
Тема BUG #11661: CASE ELSE is evaluated although condition is true
Дата
Msg-id 20141013110542.25460.3900@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #11661: CASE ELSE is evaluated although condition is true
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      11661
Logged by:          Michael Stieler
Email address:      michael@aplaypowered.com
PostgreSQL version: 9.2.6
Operating system:   RHEL
Description:

I am not sure if it is a bug, a lack in documentation or just a
misunderstanding.
This issue refers to a StackOverflow question at

https://stackoverflow.com/questions/26297035/posgtres-case-condition-with-sum-aggregation-evaluates-not-needed-else-part

The following query:
case when sum( column1 ) = 0
            then 0
            else round( sum(   price
                             * hours
                             / column1 ), 2 )
raises a division by zero error, although the condition sum(column1) = 0 is
true. I would expect that the else part would never be evaluated.
Documentation only describes that this happens for immediates.

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #10680: LDAP bind password leaks to log on failed authentication
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #11325: Documentation Bug / RFE