Thread: hstore ?& operator versus mathematics

hstore ?& operator versus mathematics

From
Tom Lane
Date:
hstore's "hstore ?& text[]" operator is defined as "contains all", ie,
it will return true if all the key names found in the text array are
present in the hstore.

ISTM that a sane definition of this operator would provide that if the
array is empty, it returns true: every set contains the empty set.
However, the code goes out of its way to return false instead.

Perhaps this was done intentionally because there was no way to make
GIN index searches work compatibly ... but now there is, so I see no
reason to remain bug-compatible with this behavior.

Barring objections, I'm going to fix it.
        regards, tom lane


Re: hstore ?& operator versus mathematics

From
David Fetter
Date:
On Sun, Jan 09, 2011 at 04:10:25PM -0500, Tom Lane wrote:
> hstore's "hstore ?& text[]" operator is defined as "contains all", ie,
> it will return true if all the key names found in the text array are
> present in the hstore.
> 
> ISTM that a sane definition of this operator would provide that if the
> array is empty, it returns true: every set contains the empty set.
> However, the code goes out of its way to return false instead.
> 
> Perhaps this was done intentionally because there was no way to make
> GIN index searches work compatibly ... but now there is, so I see no
> reason to remain bug-compatible with this behavior.
> 
> Barring objections, I'm going to fix it.

+1 for fixing it.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate