Skip to content

Instantly share code, notes, and snippets.

@kagemusha
Created June 4, 2013 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kagemusha/5708254 to your computer and use it in GitHub Desktop.
Save kagemusha/5708254 to your computer and use it in GitHub Desktop.
Postgres Selects with Booleans
v: 9.1.4
if have table users:
id is_admin
-- --------
1 t
2 f
3
#true case
select id from users where is_admin
#=> [1]
#true case
select id from users where not is_admin
#=> [2]
#undefined
select id from users where is_admin is null
#=> [3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment