public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: Brent Wood <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: concatenating hstores in a group by?
Date: Sun, 19 Jan 2025 08:16:23 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <SY7P300MB0761A579730344B2813CA07DA11B2@SY7P300MB0761.AUSP300.PROD.OUTLOOK.COM>
References: <CH2PR01MB5765698BB9F71CEB662D5AE4AD1B2@CH2PR01MB5765.prod.exchangelabs.com>
<[email protected]>
<SY7P300MB0761A579730344B2813CA07DA11B2@SY7P300MB0761.AUSP300.PROD.OUTLOOK.COM>
On 1/17/25 12:43, Brent Wood wrote:
> Hi,
>
> I have a table with a timestamp and hstore columns with times in
> milliseconds.
>
> I want to concatenate the hstores, grouped by timestamp, with the
> timestamps truncated to whole seconds: date_trunc('seconds', timer).
>
> How can I concatenate all the hstores within a one second interval,
>
> ie, something like:
>
> select timer,
> <hstores concatenated>
> from (select date_trunc('seconds', timer) as timer_sec, hstore)
> group by timer;
1) This is going to need some example data and the table definition.
2) The above query does not make sense.
3) Hstore does not store duplicate key values:
From here:
https://www.postgresql.org/docs/current/hstore.html#HSTORE-OPS-FUNCS
select 'a=>b, c=>d'::hstore || 'c=>x, d=>q'::hstore ;
?column?
------------------------------
"a"=>"b", "c"=>"x", "d"=>"q"
Are there duplicated keys and if so how do you want to handle them?
>
>
> Thanks
>
>
> Brent Wood
>
> Principal Technician, Fisheries
> NIWA
> DDI: +64 (4) 3860529
>
--
Adrian Klaver
[email protected]
view thread (8+ messages) latest in thread
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: concatenating hstores in a group by?
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox