Search Postgresql Archives

Re: CASE Statement - Order of expression processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrea Lombardoni wrote:
> It gets even stranger:
> 
> template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/(select 0) END;
>  case
> ------
>     0
> (1 row)
> 
> Here it seems that the ELSE does not get evaluated (which is correct).

Yes, of course, because both subselects will not get evaluated at
planning time.

The problem occurs only if one of the branches gets evaluated at plan time
but the condition doesn't.

Yours,
Laurenz Albe

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux