mikebridge commented on code in PR #44261:
URL: https://github.com/apache/superset/pull/44261#discussion_r4031515073


##########
superset/versioning/activity/queries.py:
##########
@@ -418,10 +418,17 @@ def _select_change_rows_for_kinds(
                 vc.c.sequence.desc(),
                 vc.c.entity_id.desc(),
             )
+            # stream_results rides the STATEMENT, never the connection:
+            # ``Connection.execution_options`` mutates the session's
+            # connection in place, permanently flipping every later
+            # statement on the request into a server-side cursor — on
+            # PostgreSQL that wraps subsequent INSERTs/SAVEPOINTs in
+            # ``DECLARE ... CURSOR FOR`` and they fail with a syntax
+            # error (observed: Continuum's transaction insert and the
+            # DBEventLogger write after an activity read; sc-120955).
             result = (
                 db.session.connection()
-                .execution_options(stream_results=True)
-                .execute(stmt)
+                .execute(stmt.execution_options(stream_results=True))

Review Comment:
   Addressed in c3add97bf50f1280876ae00e4aff94dbd6255885. The observer sees the 
actual version_changes SELECT independently of its execution options and 
requires named cursors on PostgreSQL. On disposable PostgreSQL 17, removing 
streaming failed with all([None, None]); putting it back on the connection 
failed with DECLARE CURSOR FOR INSERT. Restoring statement scope passed, with 
clean connection options and the later write intact. Also replaced the 
admin-helper Any return with FAB User. Fresh 161 versioning unit tests and 
changed-file pre-commit passed; independent final-snapshot review found no 
publication blockers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to