mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-32026 lowercase_table2.test failures in 11.3
Also fixes MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2 Change overview: - In changes made in MDEV-31948, MDEV-31982 the code path which originaly worked only in case of lower-case-table-names==1 also started to work in case of lower-case-table-names==2 in a mistake. Restoring the original check_db_name() compatible behavior (but without re-using check_db_name() itself). - MDEV-31978 erroneously added a wrong DBUG_ASSERT. Removing. Details: - In mysql_change_db() the database name should be lower-cased only in case of lower_case_table_names==1. It should not be lower-cased for lower_case_table_names==2. The problem was caused by MDEV-31948. The new code version restored the pre-MDEV-31948 behavior, which used check_db_name() behavior. - Passing lower_case_table_names==1 instead of just lower_case_table_names to the "casedn" parameter to DBNameBuffer constructor in sql_parse.cc The database name should not be lower-cased for lower_case_table_names==2. This restores pre-MDEV-31982 behavioir which used check_db_name() here. - Adding a new data type Lex_ident_db_normalized, it stores database names which are both checked and normalized to lower case in case lower_case_table_names==1 and lower_case_table_names==2. - Changing the data type for the "db" parameter to Lex_ident_db_normalized in lock_schema_name(), lock_db_routines(), find_db_tables_and_rm_known_files(). This is to avoid incorrectly passing a non-normalized name in the future. - Restoring the database name normalization in mysql_create_db_internal() and mysql_rm_db_internal() before calling lock_schema_name(). The problem was caused MDEV-31982. - Adding database name normalization in mysql_alter_db_internal() and mysql_upgrade_db(). This fixes MDEV-32026. - Removing a wrong assert in Create_sp_func::create_with_db() was incorrect: DBUG_ASSERT(Lex_ident_fs(*db).ok_for_lower_case_names()); The database name comes to here checked, but not normalized to lower case with lower-case-table-names=2. The assert was erroneously added by MDEV-31978. - Recording lowercase_tables2.results and lowercase_tables4.results according to MDEV-29446 Change SHOW CREATE TABLE to display default collations These tests are skipped on buildbot on all platforms, so this change was forgotten in the patch for MDEV-29446.
This commit is contained in:
parent
cb37c99dd8
commit
9cb75f333f
13 changed files with 151 additions and 40 deletions
57
mysql-test/main/lowercase_table2.result
Normal file → Executable file
57
mysql-test/main/lowercase_table2.result
Normal file → Executable file
|
@ -14,7 +14,7 @@ SHOW CREATE TABLE T1;
|
|||
Table Create Table
|
||||
T1 CREATE TABLE `T1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
RENAME TABLE T1 TO T2;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
|
@ -70,7 +70,7 @@ SHOW CREATE TABLE T1;
|
|||
Table Create Table
|
||||
T1 CREATE TABLE `T1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
RENAME TABLE T1 TO T2;
|
||||
SHOW TABLES LIKE "T2";
|
||||
Tables_in_test (T2)
|
||||
|
@ -319,18 +319,63 @@ Database (mysql_t%)
|
|||
mysql_TEST
|
||||
show create database mysql_test;
|
||||
Database Create Database
|
||||
mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin1 */
|
||||
mysql_test CREATE DATABASE `mysql_test` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
||||
show create database mysql_TEST;
|
||||
Database Create Database
|
||||
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET latin1 */
|
||||
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
||||
show create table mysql_TEST.T1;
|
||||
Table Create Table
|
||||
T1 CREATE TABLE `T1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
show create table mysql_test.t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
drop database mysql_TEST;
|
||||
#
|
||||
# MDEV-32026 lowercase_table2.test failures in 11.3
|
||||
#
|
||||
CREATE DATABASE Db1;
|
||||
SHOW CREATE DATABASE Db1;
|
||||
Database Create Database
|
||||
Db1 CREATE DATABASE `Db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
||||
USE Db1;
|
||||
SELECT DATABASE();
|
||||
DATABASE()
|
||||
Db1
|
||||
DROP DATABASE Db1;
|
||||
CREATE DATABASE Db1;
|
||||
CREATE FUNCTION Db1.f1() RETURNS INT RETURN 10;
|
||||
CREATE FUNCTION db1.f2() RETURNS INT RETURN 10;
|
||||
SELECT db, name FROM mysql.proc WHERE name LIKE '^f[12]';
|
||||
db name
|
||||
SELECT Db1.f1();
|
||||
Db1.f1()
|
||||
10
|
||||
SELECT db1.f2();
|
||||
db1.f2()
|
||||
10
|
||||
DROP DATABASE Db1;
|
||||
#
|
||||
# MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
|
||||
#
|
||||
CREATE DATABASE `#mysql50#D+b1`;
|
||||
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
|
||||
SHOW CREATE DATABASE `D+b1`;
|
||||
Database Create Database
|
||||
D+b1 CREATE DATABASE `D+b1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
||||
SHOW CREATE DATABASE `d+b1`;
|
||||
Database Create Database
|
||||
d+b1 CREATE DATABASE `d+b1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
|
||||
DROP DATABASE `D+b1`;
|
||||
CREATE DATABASE Db1;
|
||||
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
|
||||
SHOW CREATE DATABASE Db1;
|
||||
Database Create Database
|
||||
Db1 CREATE DATABASE `Db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */
|
||||
SHOW CREATE DATABASE db1;
|
||||
Database Create Database
|
||||
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */
|
||||
DROP DATABASE Db1;
|
||||
|
|
|
@ -288,3 +288,38 @@ show create database mysql_TEST;
|
|||
show create table mysql_TEST.T1;
|
||||
show create table mysql_test.t1;
|
||||
drop database mysql_TEST;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32026 lowercase_table2.test failures in 11.3
|
||||
--echo #
|
||||
|
||||
CREATE DATABASE Db1;
|
||||
SHOW CREATE DATABASE Db1;
|
||||
USE Db1;
|
||||
SELECT DATABASE();
|
||||
DROP DATABASE Db1;
|
||||
|
||||
CREATE DATABASE Db1;
|
||||
CREATE FUNCTION Db1.f1() RETURNS INT RETURN 10;
|
||||
CREATE FUNCTION db1.f2() RETURNS INT RETURN 10;
|
||||
SELECT db, name FROM mysql.proc WHERE name LIKE '^f[12]';
|
||||
SELECT Db1.f1();
|
||||
SELECT db1.f2();
|
||||
DROP DATABASE Db1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
|
||||
--echo #
|
||||
|
||||
CREATE DATABASE `#mysql50#D+b1`;
|
||||
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
|
||||
SHOW CREATE DATABASE `D+b1`;
|
||||
SHOW CREATE DATABASE `d+b1`;
|
||||
DROP DATABASE `D+b1`;
|
||||
|
||||
CREATE DATABASE Db1;
|
||||
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
|
||||
SHOW CREATE DATABASE Db1;
|
||||
SHOW CREATE DATABASE db1;
|
||||
DROP DATABASE Db1;
|
||||
|
|
8
mysql-test/main/lowercase_table4.result
Normal file → Executable file
8
mysql-test/main/lowercase_table4.result
Normal file → Executable file
|
@ -30,7 +30,7 @@ Create Table CREATE TABLE `Table2` (
|
|||
PRIMARY KEY (`c1`),
|
||||
KEY `fk1` (`c2`),
|
||||
CONSTRAINT `fk1` FOREIGN KEY (`c2`) REFERENCES `Table1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='test';
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
|
@ -75,7 +75,7 @@ Create Table CREATE TABLE `Product_Order` (
|
|||
KEY `Customer_Id` (`Customer_Id`),
|
||||
CONSTRAINT `product_order_ibfk_1` FOREIGN KEY (`Product_Category`, `Product_Id`) REFERENCES `Product` (`Category`, `Id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `product_order_ibfk_2` FOREIGN KEY (`Customer_Id`) REFERENCES `Customer` (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
SHOW CREATE TABLE Product;
|
||||
Table Product
|
||||
Create Table CREATE TABLE `Product` (
|
||||
|
@ -83,13 +83,13 @@ Create Table CREATE TABLE `Product` (
|
|||
`Id` int(11) NOT NULL,
|
||||
`Price` decimal(10,0) DEFAULT NULL,
|
||||
PRIMARY KEY (`Category`,`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
SHOW CREATE TABLE Customer;
|
||||
Table Customer
|
||||
Create Table CREATE TABLE `Customer` (
|
||||
`Id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='test';
|
||||
CONSTRAINT_CATALOG def
|
||||
CONSTRAINT_SCHEMA test
|
||||
|
|
|
@ -2768,7 +2768,6 @@ Create_sp_func::create_with_db(THD *thd,
|
|||
sp_name *qname;
|
||||
const Sp_handler *sph= &sp_handler_function;
|
||||
Database_qualified_name pkgname(&null_clex_str, &null_clex_str);
|
||||
DBUG_ASSERT(Lex_ident_fs(*db).ok_for_lower_case_names());
|
||||
|
||||
if (unlikely(has_named_parameters(item_list)))
|
||||
{
|
||||
|
|
|
@ -48,9 +48,10 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
A normalized database name identifier.
|
||||
- Converted to lower case if lower_case_table_names say so
|
||||
- Checked to be a valid database name
|
||||
A valid database name identifier,
|
||||
checked with check_db_name().
|
||||
It's not known if it was lower-cased or is
|
||||
in the user typed way.
|
||||
*/
|
||||
class Lex_ident_db: public Lex_ident_fs
|
||||
{
|
||||
|
@ -61,12 +62,32 @@ public:
|
|||
Lex_ident_db(const char *str, size_t length)
|
||||
:Lex_ident_fs(str, length)
|
||||
{
|
||||
DBUG_SLOW_ASSERT(ok_for_lower_case_names());
|
||||
DBUG_SLOW_ASSERT(!check_db_name());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
A normalized database name:
|
||||
- checked with check_db_name()
|
||||
- lower-cased if lower_case_table_names>0
|
||||
*/
|
||||
class Lex_ident_db_normalized: public Lex_ident_db
|
||||
{
|
||||
public:
|
||||
Lex_ident_db_normalized(const char *str, size_t length)
|
||||
:Lex_ident_db(str, length)
|
||||
{
|
||||
DBUG_SLOW_ASSERT(ok_for_lower_case_names());
|
||||
}
|
||||
explicit Lex_ident_db_normalized(const LEX_CSTRING &str)
|
||||
:Lex_ident_db(str.str, str.length)
|
||||
{
|
||||
DBUG_SLOW_ASSERT(ok_for_lower_case_names());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<size_t buff_sz>
|
||||
class IdentBuffer: public CharBuffer<buff_sz>
|
||||
{
|
||||
|
|
|
@ -881,7 +881,7 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
|
|||
or this connection was killed.
|
||||
*/
|
||||
|
||||
bool lock_schema_name(THD *thd, const char *db)
|
||||
bool lock_schema_name(THD *thd, const Lex_ident_db_normalized &db)
|
||||
{
|
||||
MDL_request_list mdl_requests;
|
||||
MDL_request global_request;
|
||||
|
@ -898,7 +898,7 @@ bool lock_schema_name(THD *thd, const char *db)
|
|||
return TRUE;
|
||||
MDL_REQUEST_INIT(&global_request, MDL_key::BACKUP, "", "", MDL_BACKUP_DDL,
|
||||
MDL_STATEMENT);
|
||||
MDL_REQUEST_INIT(&mdl_request, MDL_key::SCHEMA, db, "", MDL_EXCLUSIVE,
|
||||
MDL_REQUEST_INIT(&mdl_request, MDL_key::SCHEMA, db.str, "", MDL_EXCLUSIVE,
|
||||
MDL_TRANSACTION);
|
||||
|
||||
mdl_requests.push_front(&mdl_request);
|
||||
|
|
|
@ -36,7 +36,7 @@ int mysql_lock_remove(THD *thd, MYSQL_LOCK *locked,TABLE *table);
|
|||
bool mysql_lock_abort_for_thread(THD *thd, TABLE *table);
|
||||
MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a, MYSQL_LOCK *b, THD *thd= NULL);
|
||||
/* Lock based on name */
|
||||
bool lock_schema_name(THD *thd, const char *db);
|
||||
bool lock_schema_name(THD *thd, const Lex_ident_db_normalized &db);
|
||||
/* Lock based on stored routine name */
|
||||
bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
|
||||
const LEX_CSTRING &db, const LEX_CSTRING &name);
|
||||
|
|
|
@ -1685,7 +1685,7 @@ scan_all_gtid_slave_pos_table(THD *thd, int (*cb)(THD *, LEX_CSTRING *, void *),
|
|||
MY_DIR *dirp;
|
||||
|
||||
thd->reset_for_next_command();
|
||||
if (lock_schema_name(thd, MYSQL_SCHEMA_NAME.str))
|
||||
if (lock_schema_name(thd, Lex_ident_db_normalized(MYSQL_SCHEMA_NAME)))
|
||||
return 1;
|
||||
|
||||
build_table_filename(path, sizeof(path) - 1, MYSQL_SCHEMA_NAME.str, "", "", 0);
|
||||
|
|
|
@ -1795,7 +1795,7 @@ public:
|
|||
cases.
|
||||
*/
|
||||
|
||||
bool lock_db_routines(THD *thd, const LEX_CSTRING &db)
|
||||
bool lock_db_routines(THD *thd, const Lex_ident_db_normalized &db)
|
||||
{
|
||||
TABLE *table;
|
||||
uint key_len;
|
||||
|
|
2
sql/sp.h
2
sql/sp.h
|
@ -594,7 +594,7 @@ sp_drop_db_routines(THD *thd, const LEX_CSTRING &db);
|
|||
@retval false Success
|
||||
@retval true Failure
|
||||
*/
|
||||
bool lock_db_routines(THD *thd, const LEX_CSTRING &db);
|
||||
bool lock_db_routines(THD *thd, const Lex_ident_db_normalized &db);
|
||||
|
||||
/**
|
||||
Structure that represents element in the set of stored routines
|
||||
|
|
|
@ -55,7 +55,8 @@ const char *del_exts[]= {".BAK", ".opt", NullS};
|
|||
static TYPELIB deletable_extensions=
|
||||
{array_elements(del_exts)-1,"del_exts", del_exts, NULL};
|
||||
|
||||
static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *, const char *,
|
||||
static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *,
|
||||
const Lex_ident_db_normalized &db,
|
||||
const char *, TABLE_LIST **);
|
||||
|
||||
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
|
||||
|
@ -744,7 +745,10 @@ mysql_create_db_internal(THD *thd, const Lex_ident_db &db,
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
if (lock_schema_name(thd, db.str))
|
||||
const DBNameBuffer dbnorm_buffer(db, lower_case_table_names);
|
||||
Lex_ident_db_normalized dbnorm(dbnorm_buffer.to_lex_cstring());
|
||||
|
||||
if (lock_schema_name(thd, dbnorm))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
/* Check directory */
|
||||
|
@ -880,7 +884,10 @@ mysql_alter_db_internal(THD *thd, const Lex_ident_db &db,
|
|||
int error= 0;
|
||||
DBUG_ENTER("mysql_alter_db");
|
||||
|
||||
if (lock_schema_name(thd, db.str))
|
||||
const DBNameBuffer dbnorm_buffer(db, lower_case_table_names);
|
||||
Lex_ident_db_normalized dbnorm(dbnorm_buffer.to_lex_cstring());
|
||||
|
||||
if (lock_schema_name(thd, dbnorm))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
|
@ -1046,9 +1053,11 @@ mysql_rm_db_internal(THD *thd, const Lex_ident_db &db, bool if_exists,
|
|||
Drop_table_error_handler err_handler;
|
||||
DBUG_ENTER("mysql_rm_db");
|
||||
|
||||
const DBNameBuffer dbnorm_buffer(db, lower_case_table_names);
|
||||
Lex_ident_db_normalized dbnorm(dbnorm_buffer.to_lex_cstring());
|
||||
bzero(&ddl_log_state, sizeof(ddl_log_state));
|
||||
|
||||
if (lock_schema_name(thd, db.str))
|
||||
if (lock_schema_name(thd, dbnorm))
|
||||
DBUG_RETURN(true);
|
||||
|
||||
path_length= build_table_filename(path, sizeof(path) - 1, db.str, "", "", 0);
|
||||
|
@ -1071,7 +1080,7 @@ mysql_rm_db_internal(THD *thd, const Lex_ident_db &db, bool if_exists,
|
|||
}
|
||||
}
|
||||
|
||||
if (find_db_tables_and_rm_known_files(thd, dirp, db.str, path, &tables))
|
||||
if (find_db_tables_and_rm_known_files(thd, dirp, dbnorm, path, &tables))
|
||||
goto exit;
|
||||
|
||||
/*
|
||||
|
@ -1089,7 +1098,7 @@ mysql_rm_db_internal(THD *thd, const Lex_ident_db &db, bool if_exists,
|
|||
/* Lock all tables and stored routines about to be dropped. */
|
||||
if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
|
||||
0) ||
|
||||
lock_db_routines(thd, db))
|
||||
lock_db_routines(thd, dbnorm))
|
||||
goto exit;
|
||||
|
||||
if (!rm_mysql_schema)
|
||||
|
@ -1115,15 +1124,15 @@ mysql_rm_db_internal(THD *thd, const Lex_ident_db &db, bool if_exists,
|
|||
thd->push_internal_handler(&err_handler);
|
||||
if (!thd->killed &&
|
||||
!(tables &&
|
||||
mysql_rm_table_no_locks(thd, tables, &db, &ddl_log_state, true, false,
|
||||
mysql_rm_table_no_locks(thd, tables, &dbnorm, &ddl_log_state, true, false,
|
||||
true, false, true, false)))
|
||||
{
|
||||
debug_crash_here("ddl_log_drop_after_drop_tables");
|
||||
|
||||
LEX_CSTRING cpath{ path, path_length};
|
||||
ddl_log_drop_db(&ddl_log_state, &db, &cpath);
|
||||
ddl_log_drop_db(&ddl_log_state, &dbnorm, &cpath);
|
||||
|
||||
drop_database_objects(thd, &cpath, &db, rm_mysql_schema);
|
||||
drop_database_objects(thd, &cpath, &dbnorm, rm_mysql_schema);
|
||||
|
||||
/*
|
||||
Now remove the db.opt file.
|
||||
|
@ -1303,12 +1312,11 @@ bool mysql_rm_db(THD *thd, const Lex_ident_db &db, bool if_exists)
|
|||
|
||||
|
||||
static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
|
||||
const char *dbname,
|
||||
const Lex_ident_db_normalized &db,
|
||||
const char *path,
|
||||
TABLE_LIST **tables)
|
||||
{
|
||||
char filePath[FN_REFLEN];
|
||||
LEX_CSTRING db= { dbname, strlen(dbname) };
|
||||
TABLE_LIST *tot_list=0, **tot_list_next_local, **tot_list_next_global;
|
||||
DBUG_ENTER("find_db_tables_and_rm_known_files");
|
||||
DBUG_PRINT("enter",("path: %s", path));
|
||||
|
@ -1732,7 +1740,7 @@ uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name,
|
|||
goto done;
|
||||
}
|
||||
|
||||
new_db_file_name= lower_case_table_names ?
|
||||
new_db_file_name= lower_case_table_names == 1 ?
|
||||
new_db_buff.copy_casedn(&my_charset_utf8mb3_general_ci,
|
||||
*new_db_name).to_lex_cstring() :
|
||||
*new_db_name;
|
||||
|
@ -1917,8 +1925,11 @@ bool mysql_upgrade_db(THD *thd, const Lex_ident_db &old_db)
|
|||
new_db= Lex_ident_db(old_db.str + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
|
||||
old_db.length - MYSQL50_TABLE_NAME_PREFIX_LENGTH);
|
||||
|
||||
const DBNameBuffer dbnorm_buffer_old(old_db, lower_case_table_names);
|
||||
Lex_ident_db_normalized old_dbnorm(dbnorm_buffer_old.to_lex_cstring());
|
||||
|
||||
/* Lock the old name, the new name will be locked by mysql_create_db().*/
|
||||
if (lock_schema_name(thd, old_db.str))
|
||||
if (lock_schema_name(thd, old_dbnorm))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
/*
|
||||
|
|
|
@ -4900,7 +4900,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
|||
break;
|
||||
case SQLCOM_CREATE_DB:
|
||||
{
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names == 1);
|
||||
const Lex_ident_db db= dbbuf.to_lex_ident_db_with_error();
|
||||
|
||||
if (!db.str ||
|
||||
|
@ -4921,7 +4921,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
|||
if (thd->variables.option_bits & OPTION_IF_EXISTS)
|
||||
lex->create_info.set(DDL_options_st::OPT_IF_EXISTS);
|
||||
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names == 1);
|
||||
const Lex_ident_db db= dbbuf.to_lex_ident_db_with_error();
|
||||
|
||||
if (!db.str || prepare_db_action(thd, DROP_ACL, db))
|
||||
|
@ -4934,7 +4934,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
|||
}
|
||||
case SQLCOM_ALTER_DB_UPGRADE:
|
||||
{
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names == 1);
|
||||
const Lex_ident_db db= dbbuf.to_lex_ident_db_with_error();
|
||||
|
||||
if (!db.str ||
|
||||
|
@ -4956,7 +4956,7 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
|
|||
}
|
||||
case SQLCOM_ALTER_DB:
|
||||
{
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names == 1);
|
||||
const Lex_ident_db db= dbbuf.to_lex_ident_db_with_error();
|
||||
|
||||
if (!db.str ||
|
||||
|
@ -6236,7 +6236,7 @@ show_create_db(THD *thd, LEX *lex)
|
|||
DBUG_EXECUTE_IF("4x_server_emul",
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0)); return 1;);
|
||||
|
||||
DBNameBuffer dbbuf(lex->name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(lex->name, lower_case_table_names == 1);
|
||||
if (Lex_ident_fs(dbbuf.to_lex_cstring()).check_db_name_with_error())
|
||||
return 1;
|
||||
LEX_CSTRING db= dbbuf.to_lex_cstring();
|
||||
|
|
|
@ -4598,7 +4598,7 @@ make_table_name_list(THD *thd, Dynamic_array<LEX_CSTRING*> *table_names,
|
|||
return (schema_tables_add(thd, table_names,
|
||||
lookup_field_vals->table_value.str));
|
||||
|
||||
DBNameBuffer dbbuf(*db_name, lower_case_table_names);
|
||||
const DBNameBuffer dbbuf(*db_name, lower_case_table_names == 1);
|
||||
const Lex_ident_db dbnorm= dbbuf.to_lex_ident_db();
|
||||
if (!dbnorm.str)
|
||||
return 0; // Impossible TABLE_SCHEMA name
|
||||
|
|
Loading…
Reference in a new issue