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
adrian.kla...@aklaver.com



Reply via email to