bool_and() 是一个系统函数,当所有非NULL的输入值都为true时返回true,否则返回false。
bool_and() 于 PostgreSQL 8.0 中添加。
用法
bool_and ( boolean ) → boolean
bool_and() 等同于 SQL 标准的 every()。
变更历史
- PostgreSQL 8.0
- 添加于 (commit 8096fe45)
示例
postgres=# CREATE TABLE booltest (val bool); CREATE TABLE postgres=# INSERT INTO booltest VALUES (TRUE); INSERT 0 1 postgres=# SELECT bool_and(val) FROM booltest; bool_and ---------- t (1 row) postgres=# INSERT INTO booltest values (FALSE); INSERT 0 1 postgres=# SELECT bool_and(val) FROM booltest; bool_and ---------- f (1 row)
参考资料
- PostgreSQL 文档: 通用聚合函数,
