Re: hstore ==> and deprecate =>

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: hstore ==> and deprecate =>
Date: 2010-06-17 22:25:29
Message-ID: 4C1AA0D9.7050207@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2010-06-17 22:44:38 Re: Why aren't master and slave DBs binary identical?
Previous Message Josh Berkus 2010-06-17 22:22:00 Why aren't master and slave DBs binary identical?