I have a field:
dtype ==> character varying(3)[]
... but it's an array. So I have for example:
ID | name | dtype
1 | one | {'D10', 'D20', 'D30'}
2 | sam | {'D20'}
3 | jax | {'D10', 'D20'}
4 | pam | {'D10', 'D30'}
5 | pot | {'D10'}
I want to be able to do something like this:
select * from table where dtype in ('D20', 'D30')
This syntax doesnt work, but the goal is to then return fields 1,2,3,4 but not 5.
Is this possible?
&&... postgresql.org/docs/9.1/static/functions-array.htmlcharacter varying(3)is not an array. It's a varchar column with a max. length of 3. But if that were true, you wouldn't be able to store something like{'D10', 'D20', 'D30'}. So I guess your column is actuallycharacter varying[]? Can you do a\d table_nameand show us the complete table definition?dtypeis just a normal varchar, postgresql won't know you have placed some data in it that looks like some form of array. Can you use real postgresql arrays ?dtype && array['D20', 'D30']::varchar[]