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

From Josh Berkus
Subject Re: hstore ==> and deprecate =>
Date
Msg-id 4C1AA0D9.7050207@agliodbs.com
Whole thread Raw
In response to Re: hstore ==> and deprecate =>  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: hstore ==> and deprecate =>
List pgsql-hackers
On 6/17/10 2:03 PM, David E. Wheeler wrote:
> On Jun 17, 2010, at 1:50 PM, Josh Berkus wrote:
> 
>>> It isn't.  || already does what you're saying.
>> So what *does* it do?
> 
> It returns an hstore that's effectively a slice of another hstore. From the docs
(http://developer.postgresql.org/pgdocs/postgres/hstore.html):

OK, hammered this out on IRC with several Hstore users, and I think the
best answer here is consistency.  Both with the other hstore operators
and with other set types, such as intarray and ltree.

Currently for hstore, %% returns a flattened array and %# returns a
two-dimensional array.  That means that it makes sense that the operator
which returns an hstore subset should be something based on %, either
%>, %% or just %.

I vote for % .

Stuff we discussed and discarded includes:

& for two reasons: (a) it looks like a predicate and (b) it's used as
"intersect" for intarray and ltree, and we might want to implement
intersect for hstore someday.

# because it's used as "index" for intarray, and thus should more
properly be a synonym for -> in hstore

+> because it looks like it ought to be some kind of special incrementor.

Using % would also mean that sometime in the future we can implement !%
as "elements NOT in this list" (i.e. ' a => 1, b => 2, c => 5' !% 'a, b'
== 'c => 5' )

--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Why aren't master and slave DBs binary identical?
Next
From: Andres Freund
Date:
Subject: Re: Why aren't master and slave DBs binary identical?