I'm running this command in a Python script:
try:
print sql_string
cursor.execute(sql_string)
except:
print sys.exc_info()
and getting:
(<class 'psycopg2.InternalError'>, InternalError('current transaction is aborted, commands ignored until end of transaction block\n',), <traceback object at 0x1010054d0>)
However if I try the sql_string
from the psql command line, it works just fine. I know the script is connecting to the database okay, because I can run other commands.
How can I get Python to give me more useful information about why this command is failing within the script?