"Thomas G. Lockhart" <lockhart@alumni.caltech.edu> writes:
> So far, I haven't seen cases where the parser has tried to do "the wrong
> thing", only cases where "the right thing" causes the index handling to
> miss the boat...
I disagree, actually. In the example
select ... where i2 = 400;
I claim the parser is doing the wrong thing by representing this as
"where int4(i2) = 400::int4" rather than "where i2 = 400::int2".
It is not really reasonable to expect the optimizer to clean up
after that initial mistake.
regards, tom lane