betodealmeida commented on a change in pull request #15403:
URL: https://github.com/apache/superset/pull/15403#discussion_r666506978



##########
File path: superset/db_engine_specs/postgres.py
##########
@@ -296,3 +297,17 @@ def get_column_spec(  # type: ignore
         return super().get_column_spec(
             native_type, column_type_mappings=column_type_mappings
         )
+
+    @classmethod
+    def get_cancel_query_payload(cls, cursor: Any, query: Query) -> Any:
+        cursor.execute("SELECT current_user")
+        row = cursor.fetchone()
+        return row[0]
+
+    @classmethod
+    def cancel_query(cls, cursor: Any, query: Query, payload: Any) -> None:
+        cursor.execute(
+            "SELECT pg_terminate_backend(pid) "
+            "FROM pg_stat_activity "
+            "WHERE pid <> pg_backend_pid() and usename='%s'" % payload

Review comment:
       ```suggestion
               "WHERE pid <> pg_backend_pid() and username='%s'" % payload
   ```
   
   Won't this kill all user queries in progress?




-- 
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