答案 0 :(得分:0)
假设你有:
t=# with c(v) as (select * from generate_series(1020,1029))
select json_agg(v::text) from c;
json_agg
----------------------------------------------------------------------------------
["1020", "1021", "1022", "1023", "1024", "1025", "1026", "1027", "1028", "1029"]
(1 row)
所以你可以:
t=# with c(v) as (select * from generate_series(1020,1029))
select translate(json_agg(v::text)::text,'"',$$'$$) from c;
translate
----------------------------------------------------------------------------------
['1020', '1021', '1022', '1023', '1024', '1025', '1026', '1027', '1028', '1029']
(1 row)
当然不再有效的json了。而且我认为你只能拥有数字,所以没有意外的双引号来照顾