我正在使用Postgres,并尝试编写如下查询:
select count(*) from table where datasets = ARRAY[]也就是说,我想知道某一列有多少行有空数组,但postgres不喜欢这样:
select count(*) from super_eds where datasets = ARRAY[];
ERROR:  syntax error at or near "]"
LINE 1: select count(*) from super_eds where datasets = ARRAY[];
                                                             ^发布于 2020-05-08 01:04:58
如果你像我一样在2020年找到这个问题,正确答案是
select count(*) from table where cardinality(datasets) = 0cardinality是在PostgreSQL 9.4中添加的,大约是2015年
https://stackoverflow.com/questions/737669
复制相似问题