>>>>> "Ron" == Ron Mayer <rm...@cheapcomplexdevices.com> writes:

 Ron> Currently hstore gives me an indexed operator to query if a
 Ron> hstore contains a single key.  It'd be nice if there were as way
 Ron> to extend this so that I could ask for only records that have
 Ron> 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 a
 Ron> largely redundant intarray to be able to do fast queries for
 Ron> 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 to
 Ron> 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 have a need for the more general expressions, but if
 Ron> the code can be borrowed from intarray to handle both, that'd
 Ron> 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 have
 Ron> 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 each
 Ron> attribute - and a hstore that supported this could probably
 Ron> be a pretty nice general solution for many EAV systems.  IIRC
 Ron> other people asked about similar on the lists before.

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

-- 
Andrew.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to