Skip to content

Commit 5029f87

Browse files
Yuan325AnujJhunjhunwala
authored andcommitted
fix(prebuilt/cloud-sql-mysql): update list_table tool (googleapis#924)
This PR consist of two fixes: 1. Added `default` to table_names parameter since the default value is an empty string. 2. Update the sql statement for reusing parameter within the statement. Fixes partial googleapis#877
1 parent 2ba6ed4 commit 5029f87

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/prebuiltconfigs/tools/cloud-sql-mysql.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,18 @@ tools:
154154
) USING utf8mb4) AS object_details
155155
FROM
156156
INFORMATION_SCHEMA.TABLES T
157+
CROSS JOIN (SELECT @table_names := ?) AS variables
157158
WHERE
158159
T.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
159-
AND (NULLIF(TRIM(?), '') IS NULL OR FIND_IN_SET(T.TABLE_NAME, ?))
160+
AND (NULLIF(TRIM(@table_names), '') IS NULL OR FIND_IN_SET(T.TABLE_NAME, @table_names))
160161
AND T.TABLE_TYPE = 'BASE TABLE'
161162
ORDER BY
162163
T.TABLE_SCHEMA, T.TABLE_NAME;
163164
parameters:
164165
- name: table_names
165166
type: string
166167
description: "Optional: A comma-separated list of table names. If empty, details for all tables in user-accessible schemas will be listed."
168+
default: ""
167169
toolsets:
168170
cloud-sql-mysql-database-tools:
169171
- execute_sql

0 commit comments

Comments
 (0)