Skip to content

Commit 94e19d8

Browse files
Myst9averikitsch
andauthored
fix(tools/mysql-list-tables): Update sql query to resolve subquery scope error (#1629)
## Description --- This change fixes the `Unknown column 'T.TABLE_SCHEMA'` error in the `mysql-list-tables` tool by refactoring a correlated subquery in the SQL query to list tables. ## PR Checklist --- > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #1624 Co-authored-by: Averi Kitsch <akitsch@google.com>
1 parent 3efce3d commit 94e19d8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/tools/mysql/mysqllisttables/mysqllisttables.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ const listTablesStatement = `
145145
JSON_ARRAYAGG(S.COLUMN_NAME) AS INDEX_COLUMNS_ARRAY
146146
FROM
147147
INFORMATION_SCHEMA.STATISTICS S
148-
WHERE
149-
S.TABLE_SCHEMA = T.TABLE_SCHEMA AND S.TABLE_NAME = T.TABLE_NAME
150148
GROUP BY
151149
S.TABLE_SCHEMA, S.TABLE_NAME, S.INDEX_NAME
152150
) AS IndexData
151+
WHERE IndexData.TABLE_SCHEMA = T.TABLE_SCHEMA AND IndexData.TABLE_NAME = T.TABLE_NAME
153152
ORDER BY IndexData.INDEX_NAME
154153
),
155154
'triggers', (

0 commit comments

Comments
 (0)