我試圖做一個左連接上兩個表hstore列:postgres左加入在hstore上使用正則表達式?
SELECT
d.context->'hostname' AS hostname,
r.data->'Site' AS site,
r.data->'Region' AS rack,
r.data->'Manufacturer' AS vendor,
r.data->'ModelNumber' AS model_number,
FROM dns AS d
LEFT JOIN rack AS r ON
d.context->'hostname' ~ r.context->'Name'
;
其中兩個dns
和rack
有兩個hstore列context
和data
;左連接的條件是rack.context->'Name'
可能只包含fqdn'd dns.context->'hostname'
的一部分。
然而,當我嘗試了上面,我得到
ERROR: operator does not exist: text ~ hstore
什麼想法?
什麼postgres版本?可能是運營商的優先事項?你有沒有嘗試在兩個hstore查找周圍放置圓括號以確保它們都是字符串(如果這是你想要的) – 2013-04-22 17:40:29