Peter Bex <Peter(dot)Bex(at)xs4all(dot)nl> writes:
> But when I try to do the same but pas the 2 as a parameter,
> (I do "EXECUTE bar($1)" with $1 bound to "2"), I get an error:
Why would you do that, rather than executing the prepared statement
directly with PQexecPrepared? Interposing an EXECUTE doesn't do
anything but add parsing overhead.
The reason this particular case doesn't work is that utility statements
(including EXECUTE) don't have any support for $n parameters.
regards, tom lane