Problems with psycopg2
David Anderson
zerty.david at gmail.com
Sat May 3 18:37:23 EDT 2008
The thing is this query works fine on the console through psql, but not in
my code? can anyone explain me why?
On Thu, May 1, 2008 at 9:31 PM, David Anderson <zerty.david at gmail.com>
wrote:
> Hi all
> I have this function:
> def checkName(self, name):
> cur = self.conn.cursor()
>
> sql = "SELECT * from patient WHERE fn_pat = '" + name + "'"
> cur.execute(sql)
> rows = cur.fetchall()
>
> if rows == "[]":
> self.insert()
>
> 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)
>
> What's the problem?
> thx
>
> ps: fn_pat is the column of the db, name is the string passed in the
> function parameter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080503/7a26903a/attachment.html>
More information about the Python-list
mailing list