Background:
I'm having to move from MySQL 5.7 to MySQL 8. I do not have access to lower_case_table_names
(which is set to 0). I have ~200 stored procedures, in which the table names (e.g. my_table_1
) and their aliases in queries/DML statements (e.g. mt1
) are NOT case-sensitive.
So I have stored procedures with statements like: SELECT mt1.column1, MT1.column2 from my_table_1 MT1 where MT1.column3=100;
. In MySQL 5.7, this is a valid statement; but not in MySQL 8.
I am about to embark on a project to update all the stored procedures with the correct case.
Questions:
- Is there an easy way to achieve this update?
- The table names don't have any prefixes/suffixes to identify them uniquely. For example,
school
could be a table name, nott_school
. - Also, aliases are very generic (e.g.
s
,c
etc.)
- The table names don't have any prefixes/suffixes to identify them uniquely. For example,
- Even if I complete this task, is there a way to check whether the updates are done correctly, without executing each procedure?
- I noticed that queries get flagged as wrong when run standalone, but not when compiled as part of a stored procedure. For example, if a table name is
my_table_1
thenSELECT * from MY_TABLE_1
fails when executed as a standalone query, but if it is part of a stored procedure, the procedure gets compiled successfully (i.e. its DDL gets updated successfully). But calling the procedure causes an error.
- I noticed that queries get flagged as wrong when run standalone, but not when compiled as part of a stored procedure. For example, if a table name is