Description
When opening a SQL Editor connection (gui.sqlEditor.openConnection) on a MySQL server that has ANSI_QUOTES enabled in @@sql_mode, the connection fails with MySQL Error (1054): Unknown column 'sys' in 'where clause', followed by a secondary TypeError crash in the error handling path.
Root Cause
In DbMySQLSessionSetupTasks.py, the HeatWaveCheckTask.on_connected() method executes:
result = self.execute("""
SELECT ROUTINE_NAME
FROM information_schema.routines
WHERE ROUTINE_SCHEMA="sys"
AND ROUTINE_NAME="mle_explain_error"
AND ROUTINE_TYPE="PROCEDURE"
""").fetch_all()
This query uses double quotes for string literals ("sys", "mle_explain_error", "PROCEDURE"). When ANSI_QUOTES is enabled in sql_mode, MySQL interprets double-quoted values as identifiers (column names) rather than string literals, causing Error 1054.
Fix: Replace double quotes with single quotes:
result = self.execute("""
SELECT ROUTINE_NAME
FROM information_schema.routines
WHERE ROUTINE_SCHEMA='sys'
AND ROUTINE_NAME='mle_explain_error'
AND ROUTINE_TYPE='PROCEDURE'
""").fetch_all()
Secondary Bug: TypeError in error handling
When the above error occurs, DbSession.terminate_thread() (DbSession.py line ~247) calls:
self._message_callback('ERROR', self.thread_error)
However, DbModuleSession.on_session_message() (DbModuleSession.py) expects 3 positional arguments plus an optional one:
def on_session_message(self, type, message, result, request_id=None):
The result argument is not passed by terminate_thread(), causing:
TypeError: DbModuleSession.on_session_message() missing 1 required positional argument: 'result'
Fix: Either update terminate_thread() to pass a result argument:
self._message_callback('ERROR', self.thread_error, None)
Or make result optional in on_session_message():
def on_session_message(self, type, message, result=None, request_id=None):
Steps to Reproduce
- Configure MySQL server with
ANSI_QUOTES in sql_mode:
SET GLOBAL sql_mode = CONCAT(@@sql_mode, ',ANSI_QUOTES');
- Open VS Code with MySQL Shell for VS Code extension (v2026.2.0)
- Create a database connection and attempt to connect via the SQL Editor
Expected Behavior
Connection opens successfully regardless of the server's sql_mode setting.
Actual Behavior
Connection fails. Two errors are raised:
MySQL Error (1054): Unknown column 'sys' in 'where clause'
TypeError: DbModuleSession.on_session_message() missing 1 required positional argument: 'result'
The thread crashes and no useful error is returned to the user.
Stack Trace
ERROR: Thread ServiceSession-58220351-1d69-11f1-80e9-d03745fcfc48 exiting with code MySQL Error (1054): Unknown column 'sys' in 'where clause'
Exception in thread sql-ServiceSession-58220351-1d69-11f1-80e9-d03745fcfc48:
Traceback (most recent call last):
File "...\threading.py", line 1043, in _bootstrap_inner
self.run()
File "...\DbSession.py", line 480, in run
self.terminate_thread()
File "...\DbSession.py", line 247, in terminate_thread
self._message_callback('ERROR', self.thread_error)
TypeError: DbModuleSession.on_session_message() missing 1 required positional argument: 'result'
Environment
- Extension: Oracle MySQL Shell for VS Code v2026.2.0 (win32-x64)
- OS: Windows
- MySQL sql_mode: includes
ANSI_QUOTES
Affected Files
| File |
Issue |
gui/backend/gui_plugin/core/dbms/DbMySQLSessionSetupTasks.py |
Double quotes used as string delimiters in SQL — incompatible with ANSI_QUOTES |
gui/backend/gui_plugin/core/dbms/DbSession.py (~L247) |
terminate_thread() calls _message_callback with wrong number of arguments |
gui/backend/gui_plugin/core/modules/DbModuleSession.py |
on_session_message() requires result but caller doesn't provide it |
Description
When opening a SQL Editor connection (
gui.sqlEditor.openConnection) on a MySQL server that hasANSI_QUOTESenabled in@@sql_mode, the connection fails withMySQL Error (1054): Unknown column 'sys' in 'where clause', followed by a secondaryTypeErrorcrash in the error handling path.Root Cause
In
DbMySQLSessionSetupTasks.py, theHeatWaveCheckTask.on_connected()method executes:This query uses double quotes for string literals (
"sys","mle_explain_error","PROCEDURE"). WhenANSI_QUOTESis enabled insql_mode, MySQL interprets double-quoted values as identifiers (column names) rather than string literals, causingError 1054.Fix: Replace double quotes with single quotes:
Secondary Bug:
TypeErrorin error handlingWhen the above error occurs,
DbSession.terminate_thread()(DbSession.pyline ~247) calls:However,
DbModuleSession.on_session_message()(DbModuleSession.py) expects 3 positional arguments plus an optional one:The
resultargument is not passed byterminate_thread(), causing:Fix: Either update
terminate_thread()to pass aresultargument:Or make
resultoptional inon_session_message():Steps to Reproduce
ANSI_QUOTESinsql_mode:Expected Behavior
Connection opens successfully regardless of the server's
sql_modesetting.Actual Behavior
Connection fails. Two errors are raised:
MySQL Error (1054): Unknown column 'sys' in 'where clause'TypeError: DbModuleSession.on_session_message() missing 1 required positional argument: 'result'The thread crashes and no useful error is returned to the user.
Stack Trace
Environment
ANSI_QUOTESAffected Files
gui/backend/gui_plugin/core/dbms/DbMySQLSessionSetupTasks.pyANSI_QUOTESgui/backend/gui_plugin/core/dbms/DbSession.py(~L247)terminate_thread()calls_message_callbackwith wrong number of argumentsgui/backend/gui_plugin/core/modules/DbModuleSession.pyon_session_message()requiresresultbut caller doesn't provide it