pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: how to concat/concat_ws all fields without braces
Date: Sat, 15 Jun 2019 16:22:00 +0200
Message-ID: <20190615142200.GK10179@protected.rcdrun.com> (raw)
In-Reply-To: <1d492f68-96d7-5062-49b4-227b2fdaf617@gmx.net>
References: <20190615061957.GD2565@protected.rcdrun.com>
	<1d492f68-96d7-5062-49b4-227b2fdaf617@gmx.net>

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






view thread (6+ messages)  latest in thread

Message-ID: <20190615142200.GK10179@protected.rcdrun.com>
Permalink:  ../20190615142200.GK10179@protected.rcdrun.com/
Also on:    postgresql.org/message-id/20190615142200.GK10179@protected.rcdrun.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bugs@gnu.support, spam_eater@gmx.net
  Subject: Re: how to concat/concat_ws all fields without braces
  In-Reply-To: <20190615142200.GK10179@protected.rcdrun.com>
  References: <20190615061957.GD2565@protected.rcdrun.com> <1d492f68-96d7-5062-49b4-227b2fdaf617@gmx.net> <20190615142200.GK10179@protected.rcdrun.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox