You can also query SQLSTATE like this:
with pg.DB() as db:
try:
db.query("SELECT * FROM NoSuchTable")
except pg.DatabaseError as e:
print("ERROR: SQLSTATE={}".format(e.sqlstate))This should print "ERROR: SQLSTATE=42P01" (undefined_table). -- Christoph _______________________________________________ PyGreSQL mailing list [email protected] https://mail.vex.net/mailman/listinfo.cgi/pygresql
