Re: how to concat/concat_ws all fields without braces

Поиск
Список
Период
Сортировка
От Jean Louis
Тема Re: how to concat/concat_ws all fields without braces
Дата
Msg-id 20190615142200.GK10179@protected.rcdrun.com
обсуждение исходный текст
Ответ на Re: how to concat/concat_ws all fields without braces  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general
Dear Thomas,

* Thomas Kellerer <spam_eater@gmx.net> [2019-06-15 11:37]:
> 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;

Danke, that works well. I did not know it works
through Jansson exports. I hope it is fast enough.

Jean




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

Предыдущее
От: Jean Louis
Дата:
Сообщение: Re: how to concat/concat_ws all fields without braces
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: how to concat/concat_ws all fields without braces