Re: Executing prepared statements via bind params

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Bex <Peter(dot)Bex(at)xs4all(dot)nl>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Executing prepared statements via bind params
Date: 2011-06-16 21:19:41
Message-ID: 26496.1308259181@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Bex 2011-06-16 21:32:59 Re: Executing prepared statements via bind params
Previous Message Scott Marlowe 2011-06-16 20:32:09 Re: PostgreSQL 8.4.8 bringing my website down every evening