Joe Conway <mail@joeconway.com> writes:
> In 7.4 you could use an array. It would look like this:
Though note that 7.4 doesn't know how to optimize this form:
db=> explain select * from foo where foo_id in (1,2); QUERY PLAN
-----------------------------------------------------------------------------------------------------------------Index
Scanusing foo_pkey, foo_pkey on foo (cost=0.00..6.05 rows=2 width=756) Index Cond: ((foo_id = 1) OR (foo_id = 2))
(2 rows)
db=> explain select * from foo where foo_id = ANY (array[1,2]); QUERY PLAN
----------------------------------------------------------------------Seq Scan on foo (cost=0.00..1132.82 rows=5955
width=756) Filter: (foo_id = ANY ('{1,2}'::integer[]))
(2 rows)
--
greg