Array_agg in postgres selectively quotes

前端 未结 2 762
走了就别回头了
走了就别回头了 2021-01-26 22:15

I have a complex database with keys and values stored in different tables. It is useful for me to aggregate them when pulling out the values for the application:



        
2条回答
  •  猫巷女王i
    2021-01-26 22:58

    Can't you use json_agg?

    select json_agg(txt) from test;
                   json_agg               
    --------------------------------------
     ["one", "two", "three", "four five"]
    

提交回复
热议问题