On Mon, 11 Feb 2002 pgsql-bugs(at)postgresql(dot)org wrote:
> Janko Richter (j(dot)richter(at)wallstreet-develop(dot)de) reports a bug with a severity of 2
> The lower the number the more severe it is.
>
> Short Description
> Optimizer uses seq scan only
You'll need to cast the value you're comparing with to int8
(12345::int8 or CAST(12345 as int8) should work).