In article <2499.1238420859@sss.pgh.pa.us>,
Tom Lane <tgl@sss.pgh.pa.us> writes:
> In particular, a constraint like "sel=123" is *not* going to lead the
> planner to draw any conclusions about the value of "mod(sel,6)".
> Now, if you'd written "WHERE mod(sel,6)=3", I think it would draw
> the right conclusions.
Yes, it does. It might be worthwile to use
WHERE sel=123 AND mod(sel,6)=3
I think you could use a rule to add the mod() condition automatically.