Re: hstore ==> and deprecate => - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: hstore ==> and deprecate =>
Date
Msg-id F2551EB9-59B1-4481-A96E-28C5DFDE585E@kineticode.com
Whole thread Raw
In response to Re: hstore ==> and deprecate =>  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: hstore ==> and deprecate =>
List 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
correlatesin 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
returnsan hstore. 

Anyway, the more I look at it the less I care, as long as *something* works.

Best,

David



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: streaming replication breaks horribly if master crashes
Next
From: Tom Lane
Date:
Subject: Re: Keepalive for max_standby_delay