Re: hstore improvements? - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: hstore improvements?
Date
Msg-id 878wn5bobr.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to hstore improvements?  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
>>>>> "Ron" == Ron Mayer <rm_pg@cheapcomplexdevices.com> writes:
Ron> Currently hstore gives me an indexed operator to query if aRon> hstore contains a single key.  It'd be nice if
therewere as wayRon> to extend this so that I could ask for only records that haveRon> all or any the keys in a query.
 
Ron>   'a=>1, b=>1'::hstore ? 'a,b'
Ron> In one database I put ids of each of the keys in a hstore into aRon> largely redundant intarray to be able to do
fastqueries forRon> rows containing all the hstore-keys in a set.
 

I think trying to overload this onto ? would be possibly a bit too
confusing; would  hstore ? text[]  mean "any match", or "all match"?

How about  hstore ?& text[]  for "all match", and hstore ?| text[]
for "any match"?
Ron> Even cooler might be extending the hstore '?' operator toRon> allow expressions similar to intarray's queries:Ron>
 'a=>1, b=>1'::hstore ? 'a|b'Ron>   'a=>1, b=>1'::hstore ? 'a&b'Ron>   'a=>1, b=>1'::hstore ? 'a&(b|c)'Ron> I don't
havea need for the more general expressions, but ifRon> the code can be borrowed from intarray to handle both,
that'dRon>be sweet.
 

While that is possible, it involves adding a lot more than I planned
to at this stage.
Ron> I once wanted a variation of hstore where a key could haveRon> multiple values(and the ability to query them).Ron>
 'a=>x, a=>y'::hstore @> 'a=>x'Ron> I imagine most EAV systems allow multiple values for eachRon> attribute - and a
hstorethat supported this could probablyRon> be a pretty nice general solution for many EAV systems.  IIRCRon> other
peopleasked about similar on the lists before.
 

This is definitely going too far - such a thing would have to be a
new type entirely.

-- 
Andrew.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to implement an auto-increment column for a system catalog table?
Next
From: Heikki Linnakangas
Date:
Subject: Re: Review: B-Tree emulation for GIN