1
內部存在的元素的行下面是我postgres的9.3表獲取基於所述的Postgres int數組
id arr
1 [1,2,3]
2 [1,2]
3 [1]
4 [2]
5 [4,5,6]
如果我搜索1,2-我期待輸出如下。我想我嘗試使用下面的查詢其或者含有1個或2
id arr
1 [1,2,3]
2 [1,2]
3 [1]
4 [2]
的所有行,即使用任何
Select * from test where arr = ANY ('{1,2}'::int[])
它給出了一個錯誤
ERROR: operator does not exist: integer[] = integer Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 30
如何做到這一點?
SQLFiddle - http://sqlfiddle.com/#!15/63c4f/4
你是救世主:) –