Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)DE> writes:
> Is this a bug in my function or in my mind or in postgres?
> Are functions using indexes?
The planning context is different because the planner cannot see a
specific constant in the WHERE clause, only a parameter placeholder.
This might affect the choice of plan --- but without knowing what
indexes you have and what choices are being made, it's hard to say
much.
One question worth asking is whether you've declared the type of
the parameter to agree with the type of the column it's being
compared to.
regards, tom lane