I'm trying to query hstore for all the values of a certain key that match a search criteria.
I can get all the values for a certain key like this:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier']))
FROM "products"
I can also get a specific value:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE data @> 'Supplier => Toshiba'
What I would really like is something like (this doesn't work):
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE data @> 'Supplier => %tosh%'
or:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE lower(sup)
LIKE '%tosh%'
for case-insensitive search. How is this done?