mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
9695974e4b
Problem: sp_cache erroneously looked up fully qualified SP names (e.g. `DB`.`SP`), in case insensitive style. It was wrong, because only the "name" part is always case insensitive, while the "db" part should be compared according to lower_case_table_names (case sensitively for 0, case insensitively for 1 and 2). Fix: Adding a "casedn_name" parameter make_qname() to tell if the name part should be lower cased: `DB1`.`SP` -> "DB1.SP" (when casedn_name=false) `DB1`.`SP` -> "DB1.sp" (when casedn_name=true) and using make_qname() with casedn_name=true when creating sp_cache hash lookup keys. Details: As a result, it now works as follows: - sp_head::m_db is converted to lower case if lower_case_table_names>0 during the sp_name initialization phase. So when make_qname() is called, sp_head::m_db is already normalized. There are no changes in here. - The initialization phase of sp_head when creating sp_head::m_qname now calls make_qname() with casedn_name=true, so sp_head::m_name gets written to sp_head::m_qname in lower case. - sp_cache_lookup() now also calls make_qname() with casedn_name=true, so sp_head::m_name gets written to the temporary lookup key in lower case. - sp_cache::m_hashtable now uses case sensitive comparison
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
CREATE DATABASE mysql_TEST CHARACTER SET utf8;
|
|
SHOW CREATE DATABASE mysql_TEST;
|
|
Database Create Database
|
|
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */
|
|
CREATE DATABASE mysql_test CHARACTER SET latin2;
|
|
SHOW CREATE DATABASE mysql_test;
|
|
Database Create Database
|
|
mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_general_ci */
|
|
SHOW CREATE DATABASE mysql_TEST;
|
|
Database Create Database
|
|
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci */
|
|
DROP DATABASE mysql_test;
|
|
DROP DATABASE mysql_TEST;
|
|
#
|
|
# Start of 10.4 tests
|
|
#
|
|
#
|
|
# MDEV-33019 The database part is not case sensitive in SP names
|
|
#
|
|
CREATE DATABASE DB1;
|
|
CREATE DATABASE db1;
|
|
CREATE PROCEDURE DB1.sp() SELECT 'This is DB1.sp' AS ret;
|
|
CREATE PROCEDURE db1.sp() SELECT 'This is db1.sp' AS ret;
|
|
CALL DB1.sp();
|
|
ret
|
|
This is DB1.sp
|
|
CALL db1.sp();
|
|
ret
|
|
This is db1.sp
|
|
DROP DATABASE DB1;
|
|
CALL DB1.sp();
|
|
ERROR 42000: PROCEDURE DB1.sp does not exist
|
|
CALL db1.sp();
|
|
ret
|
|
This is db1.sp
|
|
DROP DATABASE db1;
|
|
CREATE PROCEDURE SP() SELECT 'This is SP' AS ret;
|
|
CREATE PROCEDURE sp() SELECT 'This is sp' AS ret;
|
|
ERROR 42000: PROCEDURE sp already exists
|
|
CALL SP();
|
|
ret
|
|
This is SP
|
|
CALL sp();
|
|
ret
|
|
This is SP
|
|
DROP PROCEDURE SP;
|
|
#
|
|
# End of 10.4 tests
|
|
#
|