Re: hstore improvements? - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: hstore improvements?
Date
Msg-id 7204679A-96C9-428A-AAB0-CEAF12FACD4D@kineticode.com
Whole thread Raw
In response to Re: hstore improvements?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: hstore improvements?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: hstore improvements?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mar 13, 2009, at 1:21 PM, Andrew Gierth wrote:

>>>>>> I'm thinking that (hstore -> text[]) should probably return  
>>>>>> text[],
> and maybe (hstore => text[]) returning hstore?
>
> i.e.
>
> select ('a=>1,b=>2,c=>3'::hstore) -> ARRAY['a','b'];
>  -- returns '{1,2}'
>
> select ('a=>1,b=>2,c=>3'::hstore) => ARRAY['a','b'];
>  -- returns 'a=>1,b=>2'
>
> (by analogy to the existing operators -> for lookup and => for
> construction)

Is a more Perlish syntax out of the question?

SELECT ('a=>1,b=>2,c=>3'::hstore)['a', 'b']; -- returns '{1,2}'
select ('a=>1,b=>2,c=>3'::hstore){'a','b'}; -- returns 'a=>1,b=>2'

Best,

David


pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: hstore improvements?
Next
From: Andrew Gierth
Date:
Subject: Re: hstore improvements?