Re: how to concat/concat_ws all fields without braces

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: how to concat/concat_ws all fields without braces
Дата
Msg-id 1d492f68-96d7-5062-49b4-227b2fdaf617@gmx.net
обсуждение исходный текст
Ответ на how to concat/concat_ws all fields without braces  (Jean Louis <bugs@gnu.support>)
Ответы Re: how to concat/concat_ws all fields without braces  (Jean Louis <bugs@gnu.support>)
Список pgsql-general
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;






В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: how to concat/concat_ws all fields without braces
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: arrays of composite types, and client drivers like JDBC