PostgreSql : using a statement as case condition -


when use statement case condition returns false;

select * table order (case when (true) id else 1/0 end)  desc -- works  select * table order (case when (select true) id else 1/0 end)  desc -- exception select * table order (case when (1=1) id else 1/0 end)  desc -- works select * table order (case when (select 1=1) id else 1/0 end)  desc -- exception 

what wrong condition?

the case when expects boolean result condition per documentation:

each condition expression returns boolean result.

the select statements return relation (yes, single row having single column boolean type , value of true still not boolean).


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -