Search Postgresql Archives

Re: how to concat/concat_ws all fields without braces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean Louis schrieb am 15.06.2019 um 13:19:
> I have tried doing something like:
> 
> SELECT concat_ws(' ', table.*) FROM table;
> 
> and if I do that way, it is essentially same as 
> 
> SELECT concat(table.*) FROM table;
> 
> and I get the items in braces like (1,something).
> 
> Why do I get it in braces?
> 
> Is there a way without specifying specific fields
> to get all items concatenated without braces?
> 
> I would prefer conat_ws option.

you can use the json functions for that:

  select (select string_agg(x.v, ',') from jsonb_each_text(to_jsonb(t)) as x(k,v)) as all_columns
  from the_table t;








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux