当一个表中有350行时,数组_acum在postgres SQL中返回空值

当一个表中有350行时,数组_acum在postgres SQL中返回空值,sql,postgresql,aggregate,postgresql-9.1,postgresql-9.2,Sql,Postgresql,Aggregate,Postgresql 9.1,Postgresql 9.2,我使用下面的查询 select distinct throttle_id, array_accum(param) over (partition by throttle_id) as script_exclude from throttle_data where exclude = 't' and valve_type = 513 and throttle_id = 1270571881 我在script\u exclude字段中得到空值 param列中的示例值是 机票/定价/发布0tc.wq

我使用下面的查询

select distinct throttle_id, array_accum(param) over (partition by throttle_id) as script_exclude from throttle_data where exclude = 't' and valve_type = 513 and throttle_id = 1270571881
我在
script\u exclude
字段中得到空值

param列中的示例值是

机票/定价/发布0tc.wql机票/定价/发布0xp.wql机票/定价/发布0xp\U down.wql机票/定价/发布0xp\U up.wql

行数为
351

请告诉我如何才能得到这些所有的价值

问候,,
Sachin Jain

请尝试以下方法:

select throttle_id, array_agg(param) as script_exclude 
  from throttle_data where exclude = 't' 
       and valve_type = 513 and throttle_id = 1270571881
group by throttle_id;
如果仍然返回null,请尝试:

select * from throttle_data
 WHERE exclude = 't'
       and valve_type = 513 and throttle_id = 1270571881;
查看实际聚合的内容

如果没有返回任何行,那么where子句中的条件就有问题。

数组的作用是什么?这不是标准的Postgres函数。如果您想要一个逗号分隔的列表,那么为什么不使用
string\u agg()
。另外:您将
distinct
与窗口函数一起使用的方式似乎表明您实际上希望
groupby
具有常规聚合