Answer the question
In order to leave comments, you need to log in
Why does Postgresql throw an error on execute query?
There was a question, I have already faced the problem many times, sometimes it was solved after a couple of launches of the program (Which is rather strange). And so, the problem is that when I execute a database query, postgresql gives me an error.
The code:
money = sqlexecute(f"SELECT money FROM main WHERE user_id = {str(user_id)}")[0]
def sqlexecute(execute):
sql.execute(str(execute))
return sql.fetchall()[0]
File "...", line 673, in moneycheck
money = sqlexecute(f"SELECT money FROM main WHERE user_id = {str(user_id)}")[0]
File "...", line 655, in sqlexecute
return sql.fetchall()[0]
psycopg2.ProgrammingError: no results to fetch
sqz = psycopg2.connect(database='...', user='...', password='...')
sql = sqz.cursor()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question