From: Brent Wood <Brent.Wood@niwa.co.nz>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: hstore each() function - returned order??
Date: Fri, 12 Mar 2021 03:46:58 +0000
Message-ID: <SY3PR01MB0810FF20F164CE2536930B2CA16F9@SY3PR01MB0810.ausprd01.prod.outlook.com> (raw)
Hi,
I'm using the following in an SQL :
select (EACH(value)).key as measurement_key,
(EACH(value)).value as value
from t_reading_hstore;
I'm assuming this will give two columns containing the key/value pairs in the hstore record.
The docs suggest the order of the keys/values returned is undetermined. That is a bit ambiguous to me.
The order is not a problem in this case: as long as the keys and values are returned in the SAME order, what that order is I don't care.
Just that the key is always returned in the same row as its value.
It does seem to work, at least in my test cases, but I need to know if that is just luck, or if it is a safe assumption to make.
Can anyone confirm this is a robust assumption for me?
Thanks
Brent Wood
Principal Technician, Fisheries
NIWA
DDI: +64 (4) 3860529
[https://www.niwa.co.nz/static/niwa-2018-horizontal-180.png][https://niwa.co.nz/sites/niwa.co.nz/files/ETNZ_Official-supplier-logo-75h.png]<https://www.niwa.co.nz;
Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529
National Institute of Water & Atmospheric Research Ltd (NIWA)
301 Evans Bay Parade Hataitai Wellington New Zealand
Connect with NIWA: niwa.co.nz<https://www.niwa.co.nz; Facebook<https://www.facebook.com/nzniwa; LinkedIn<https://www.linkedin.com/company/niwa; Twitter<https://twitter.com/niwa_nz; Instagram<https://www.instagram.com/niwa_science;
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems
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: Brent.Wood@niwa.co.nz
Subject: Re: hstore each() function - returned order??
In-Reply-To: <SY3PR01MB0810FF20F164CE2536930B2CA16F9@SY3PR01MB0810.ausprd01.prod.outlook.com>
References: <SY3PR01MB0810FF20F164CE2536930B2CA16F9@SY3PR01MB0810.ausprd01.prod.outlook.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