Problems with psycopg2

David Anderson zerty.david at gmail.com
Thu May 1 20:31:01 EDT 2008


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/20080501/f55259fb/attachment.html>


More information about the Python-list mailing list