Dawid Kuroczko <qnex42(at)gmail(dot)com> writes:
> But when I phrase the query:
> SELECT * FROM table WHERE (icount(ids) <= 1 AND ids[1] = 33) OR
> (icount(ids) > 1 AND ids && '{33}');
> Planner insists on using seqscan. Even with enable_seqscan = off;
The OR-index-scan mechanism isn't currently smart enough to use partial
indexes that are only valid for some of the OR'd clauses rather than all
of them. Feel free to fix it ;-). (This might not even be very hard;
I haven't looked.)
regards, tom lane