Answer the question
In order to leave comments, you need to log in
Problem in psycopg2?
cursor.execute(f"SELECT id FROM property WHERE id = {member.id} and server_id = {server}")
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
What could be the problem?
Answer the question
In order to leave comments, you need to log in
The problem is that the previous request ended with an error and the transaction must be rolled back, or the construction with with must be used, then the transaction will be automatically rolled back if an error
occurs https://www.psycopg.org/docs/connection.html#conne...
conn = psycopg2.connect(DSN)
with conn:
with conn.cursor() as curs:
curs.execute(SQL1)
conn.close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question