Re: Problems in queries

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: "David Anderson" <zerty(dot)david(at)gmail(dot)com>
Subject: Re: Problems in queries
Date: 2008-05-04 00:02:43
Message-ID: 200805031702.44021.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday 03 May 2008 4:05 pm, David Anderson wrote:
> Hi all
> I have this function:
> def checkNameDob(self, name, dob):
> cur = self.conn.cursor();
>
> sql = "SELECT * from patient WHERE fn_pat = %s"
> cur.execute(sql,(name))
> rows = cur.fetchall()
>
> It seems to work fine, But I'm getting this exception:
> psycopg2.ProgrammingError: current transaction is aborted, commands ignored
> until end of transaction block
> at: cur.execute(sql)
If I remember right
cur.execute(sql,(name))
should be
cur.execute(sql,(name,))
note the comma after name.

>
> What's the problem?
> thx
>
> ps: fn_pat is the column of the db, name is the string passed in the
> function parameter.
> if I type:
> "SELECT * from patient WHERE fn_pat = 'david' "
> in the psql on console it works well...

--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dan "Heron" Myers 2008-05-04 00:20:50 Re: custom C function problem
Previous Message David Anderson 2008-05-03 23:05:30 Problems in queries