我正在尝试在 hstore 中查询与搜索条件匹配的某个键的所有值。
我可以像这样获取某个键的所有值:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier']))
FROM "products"
我还可以获得一个特定的值:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE data @> 'Supplier => Toshiba'
我真正想要的是(这不起作用):
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE data @> 'Supplier => %tosh%'
或者:
SELECT DISTINCT
svals(slice(data, ARRAY['Supplier'])) AS sup
FROM "products"
WHERE lower(sup)
LIKE '%tosh%'
用于不区分大小写的搜索。这是怎么做到的?