[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] prepared query plan did not update
From:       Stephan Szabo <sszabo () megazone ! bigpanda ! com>
Date:       2008-09-17 20:38:29
Message-ID: 20080917133722.S22496 () megazone ! bigpanda ! com
[Download RAW message or body]

On Wed, 17 Sep 2008, Emi Lu wrote:

> Stephan Szabo wrote:
> > On Wed, 17 Sep 2008, Emi Lu wrote:
> >
> >> Good morning,
> >>
> >> I tried to use prepared query plan to update columns, but it did not
> >> update at all.
> >>
> >> PREPARE pname(varchar) AS
> >> UPDATE t1
> >> SET    col1 = false
> >> WHERE  col1 AND
> >>         col2 = '$1' ;
> >
> > I don't think you want those quotes in the second part of the where
> > clause. I'm pretty sure that means you're comparing against the literal
> > string with a dollar sign and one rather than the value given at execute
> > time for $1.
>
> Do you mean:
>
> PREPARE pname(varchar) AS
> UPDATE t1
> SET   col1 = false
> WHERE col1 AND
>        col2 = $1 ;
>
> But still does not work? Strange, right?

I think we'll need to see a complete example with table definitions and
sample data because it does appear to work for me in simple tests.

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic