Are All Values True in Postgres
If you have values like this:
chriserin=# select * from (values (true), (false), (true)) x(x);
x
---
t
f
t
You might want to see if all of them are true. You can do that with bool_and
:
chriserin=# select bool_and(x.x) from (values (true), (false), (true)) x(x);
bool_and
---
f
And when they are all true:
chriserin=# select bool_and(x.x) from (values (true), (true), (true)) x(x);
bool_and
---
t
Tweet