From: | "David E(dot) Wheeler" <david(at)kineticode(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Michael Glaesemann <grzm(at)seespotcode(dot)net>, Merlin Moncure <mmoncure(at)gmail(dot)com> |
Subject: | Re: hstore ==> and deprecate => |
Date: | 2010-06-17 00:56:13 |
Message-ID: | F2551EB9-59B1-4481-A96E-28C5DFDE585E@kineticode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jun 16, 2010, at 4:58 PM, Tom Lane wrote:
>> hstore => text[] is new in 9.0.
>
> Wup, sorry, I read this as being the other operator. Nevermind ...
>
> (FWIW, I share your dislike of & for this operator. I just haven't
> got a better idea.)
There aren't any very good choices. Possible correlates:
text[] key_slice := my_hstore -> ARRAY['foo', 'bar'];
bool has_keys := my_hstore ?& ARRAY['foo', 'bar'];
text[] keyvals := %% my_hstore;
text[] keyvals := %# my_hstore;
Frankly, %% and %# are closest, in a sense. But instead of an array, we want to get back an hstore. -> and ?& are correlates in that their RHSs are arrays.
Possible operators to get a slice of the hstore:
hstore slice := my_hstore +> ARRAY['foo', 'bar'];
hstore slice := my_hstore #> ARRAY['foo', 'bar'];
hstore slice := my_hstore &> ARRAY['foo', 'bar'];
hstore slice := my_hstore !> ARRAY['foo', 'bar'];
hstore slice := my_hstore *> ARRAY['foo', 'bar'];
hstore slice := my_hstore %> ARRAY['foo', 'bar'];
hstore slice := my_hstore @ ARRAY['foo', 'bar'];
hstore slice := my_hstore % ARRAY['foo', 'bar'];
hstore slice := my_hstore # ARRAY['foo', 'bar'];
hstore slice := my_hstore & ARRAY['foo', 'bar'];
hstore slice := my_hstore @# ARRAY['foo', 'bar'];
Maybe %> is good, in that it combines %% and ->, in a sense. Or #>, which kind of goes along with #=, which also returns an hstore.
Anyway, the more I look at it the less I care, as long as *something* works.
Best,
David
From | Date | Subject | |
---|---|---|---|
Next Message | Brent Dombrowski | 2010-06-17 01:31:22 | Re: [PATCH] elimination of code duplication in DefineOpFamily() |
Previous Message | Tom Lane | 2010-06-16 23:58:22 | Re: hstore ==> and deprecate => |