Re: how to concat/concat_ws all fields without braces - Mailing list pgsql-general

From Jean Louis
Subject Re: how to concat/concat_ws all fields without braces
Date
Msg-id 20190615142200.GK10179@protected.rcdrun.com
Whole thread Raw
In response to Re: how to concat/concat_ws all fields without braces  (Thomas Kellerer <spam_eater@gmx.net>)
List 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 by date:

Previous
From: Jean Louis
Date:
Subject: Re: how to concat/concat_ws all fields without braces
Next
From: Pavel Stehule
Date:
Subject: Re: how to concat/concat_ws all fields without braces