Re: hstore improvements?

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: david(at)kineticode(dot)com ("David E(dot) Wheeler"), pgsql-hackers(at)postgresql(dot)org
Subject: Re: hstore improvements?
Date: 2009-03-13 21:26:51
Message-ID: 87mybpgllw.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "David" == "David E Wheeler" <david(at)kineticode(dot)com> writes:

>> 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)

David> Is a more Perlish syntax out of the question?

Yes. Sorry.

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

That would require integrating hstore into core - array subscripting
isn't a user-definable operation.

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

And that would require changing the parser...

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2009-03-13 21:31:23 Re: hstore improvements?
Previous Message David E. Wheeler 2009-03-13 20:55:38 Re: hstore improvements?