From: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
---|---|
To: | Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: hstore improvements? |
Date: | 2009-03-16 13:16:08 |
Message-ID: | 878wn5bobr.fsf@news-spur.riddles.org.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>>>>> "Ron" == Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2009-03-16 13:54:24 | Remaining items for 8.4 (was Re: Updates of SE-PostgreSQL 8.4devel patches (r1710)) |
Previous Message | Tom Lane | 2009-03-16 12:40:11 | Re: How to implement an auto-increment column for a system catalog table? |