Re: [GENERAL] CREATE AGGREGATE on jsonb concat - Mailing list pgsql-general

From Seamus Abshere
Subject Re: [GENERAL] CREATE AGGREGATE on jsonb concat
Date
Msg-id 1499371938.1646099.1032751664.29834335@webmail.messagingengine.com
Whole thread Raw
In response to Re: [GENERAL] CREATE AGGREGATE on jsonb concat  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [GENERAL] CREATE AGGREGATE on jsonb concat  (Seamus Abshere <seamus@abshere.net>)
List pgsql-general
> Seamus Abshere <seamus@abshere.net> writes:
> > We do this in our database:
>
> > CREATE AGGREGATE jsonb_collect(jsonb) (
> >     SFUNC = 'jsonb_concat',
> >     STYPE = jsonb,
> >     INITCOND = '{}'
> > );
>
> > Is there some other built-in aggregate I'm missing that would do the
> > same thing? It just feels like such an obvious feature.

> On Thu, Jul 6, 2017, at 04:53 PM, Tom Lane wrote:
> Doesn't jsonb_agg() do exactly that?

hi Tom,

That aggregates into an array. Our `jsonb_collect` aggregates into an
object.

Best,
Seamus


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] CREATE AGGREGATE on jsonb concat
Next
From: Tamás András Kálmán
Date:
Subject: [GENERAL] Modified rows are not marked as dead and as such vacuum is unable toclean them up