I have a multi-threaded Python application, in which when I increase the number of threads to process more data at the same time, I am getting this error
psycopg2.ProgrammingError: no results to fetch
any suggestion on what could be causing this issue?
It's working fine with less number of threads.
I found the solution to my answer,
I was using the same cursor to execute the query and get data for all of the threads, so when a number of threads gets increased there is more change of that cursor getting overwritten by another query in between executing the query and fetching the record,
Another thread overwriting the cursor in the middle of a transaction,
So now I am creating a new cursor like this,
newCursor = self.connection.cursor(cursor_factory=RealDictCursor)
and everything is working fine.