Re: concatenating hstores in a group by? - Mailing list pgsql-general

From Tom Lane
Subject Re: concatenating hstores in a group by?
Date
Msg-id 2739254.1737305093@sss.pgh.pa.us
Whole thread Raw
In response to concatenating hstores in a group by?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Friday, January 17, 2025, Brent Wood <Brent.Wood@niwa.co.nz> wrote:
>> I want to concatenate the hstores,

> There are no hstore aggregate functions.

It would be trivial to make a user-defined one.
More or less (untested)

create aggregate hstore_agg(hstore)
(
  sfunc = hs_concat,
  stype = hstore
);

Either way though, the order of aggregation is unspecified and thus
it's unclear which input will win when there are duplicate keys.
If that matters then you'll need to think about how you want
to resolve it.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: concatenating hstores in a group by?
Next
From: Brent Wood
Date:
Subject: Re: concatenating hstores in a group by?