Jeff <threshar@torgo.978.org> writes:
> Perhaps this should go on the TODO - when one side is an int8 and the
> other is a literal number assume the number to be int8 instead of int4?
It's been on TODO for so long that it's buried near the bottom.
* Allow SELECT * FROM tab WHERE int2col = 4 to use int2col index, int8,
float4, numeric/decimal too [optimizer]
This behavior interacts with enough other stuff that we can't just
change it willy-nilly. See many past discussions in the pghackers
archives if you want details. A recent example of a promising-looking
fix crashing and burning is
http://fts.postgresql.org/db/mw/msg.html?mid=1357121
regards, tom lane