arrays - PostgreSQL HSTORE GIN query -


i can't figure out how re-write query using arrays test cases:

--explain select  count(id)    (     select  t.id        product2 t       (ext @> 'p01=>1' or ext @> 'p01=>2')     , (ext @> 'p02=>1' or ext @> 'p02=>2' or ext @> 'p02=>3')     , (ext @> 'p03=>2' or ext @> 'p03=>3' or ext @> 'p03=>4' or ext @> 'p03=>5' or ext @> 'p03=>6') ) t 

i'm looking ext @> 'p01=[1,2]'. documentation doesn't indicate if possible.

note: if ranges possible, don't want them.

the following extract values key 'p01' , return true if matches found in array. after?

select ('p01=>1,p01=>2,p02=>1,p02=>3,p02=>5'::hstore -> 'p01')::integer = any(array[1,2,3,4,5]) 

modified original query

select count(*)    (         select t2.id         product2 t2         (ext::hstore -> 'p01')::integer = any(array[1,2])         , (ext::hstore -> 'p02')::integer = any(array[1,2,3])         , (ext::hstore -> 'p03')::integer = any(array[2,3,4,5,6])         ) t; 

that gives unexpected results?


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -