Alex Pilosov <alex(at)pilosoft(dot)com> writes:
> Example, having a statement like 'select count(*) from foo where
> fieldname=$1' where I know that $1 is a stringish type and it _should_ be
> convertable using xxx_in (CString-to-datum conversion functions), however,
> I do not know the precise type (could be name or varchar or text).
Declare the parameter as text, and then coerce what you are given to
text before you execute the statement. You don't get any free
adaptation to new datatypes in an already-completed plan.
regards, tom lane