Re: how to concat/concat_ws all fields without braces

From: Jean Louis <bugs(at)gnu(dot)support>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: how to concat/concat_ws all fields without braces
Date: 2019-06-15 14:22:00
Message-ID: 20190615142200.GK10179@protected.rcdrun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Thomas,

* Thomas Kellerer <spam_eater(at)gmx(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2019-06-15 14:37:19 Re: how to concat/concat_ws all fields without braces
Previous Message Jean Louis 2019-06-15 14:20:38 Re: how to concat/concat_ws all fields without braces