Re: [GENERAL] Executing prepared statements via bind params

2011-06-16 Thread Peter Bex
On Thu, Jun 16, 2011 at 05:19:41PM -0400, Tom Lane wrote: > Peter Bex 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

Re: [GENERAL] Executing prepared statements via bind params

2011-06-16 Thread Tom Lane
Peter Bex 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 pa

[GENERAL] Executing prepared statements via bind params

2011-06-16 Thread Peter Bex
Hi all, I'm seeing a bit strange (some might say inconsistent) behaviour, possibly a bug. First, I prepare a statement by running the query: "PREPARE bar (int) AS (SELECT 1, $1, 3)" Then I try to use the generic libpq query function PQsendQueryParams with a query of "EXECUTE bar(2)" and I ge