-
-
Notifications
You must be signed in to change notification settings - Fork 207
Closed
Description
When upgrading from 3.1.5 to 3.1.6 we started seeing an error for the below code.
We have code that looks something like:
def simplified_function():
# ...
with psycopg.connect(
dbname=os.environ["APP_DB"],
host=os.environ["APP_DNS"],
port=os.environ["APP_PORT"],
user=os.environ["APP_RO_USER"],
password=os.environ["APP_RO_PASSWORD"],
application_name="app_name",
) as conn:
with conn.cursor(
row_factory=dict_row,
) as cursor:
cursor.execute(
"""
SELECT
dt.val AS val
FROM
database_table AS dt
"""
)
return {row["vall"] for row in cursor.fetchall()}
Relevant piece of the stack trace:
| rows = cursor.fetchmany(NUMBER_ROWS_READ)
| File "/opt/bb/lib/python3.10/site-packages/psycopg/server_cursor.py", line 322, in fetchmany
| recs = self._conn.wait(self._fetch_gen(size))
| File "/opt/bb/lib/python3.10/site-packages/psycopg/connection.py", line 957, in wait
| return waiting.wait(gen, self.pgconn.socket, timeout=timeout)
| File "psycopg_binary/_psycopg/waiting.pyx", line 193, in psycopg_binary._psycopg.wait_c
| File "/opt/bb/lib/python3.10/site-packages/psycopg/server_cursor.py", line 178, in _fetch_gen
| return self._tx.load_rows(0, res.ntuples, self._make_row)
| File "psycopg_binary/_psycopg/transform.pyx", line 490, in psycopg_binary._psycopg.Transformer.load_rows
| File "/opt/bb/lib/python3.10/site-packages/psycopg/rows.py", line 221, in no_result
| raise e.InterfaceError("the cursor doesn't have a result")
deppe and dvarrazzo
Metadata
Metadata
Assignees
Labels
No labels