Dave Cramer <pg(at)fastcrypt(dot)com> writes:
> The only time prepared statements won't replan is if you re-use the
> prepared statement, which your code does not.
> However... AFAIK, postgresql does not plan based on the parameter.
This was changed in 8.2: for an unnamed statement the planning step is
delayed until Bind time, so that the actual parameter values can be
considered.
regards, tom lane