MDEV-13017 LOCK TABLE fails with irrelevant error while working with tables affected by ANSI_QUOTES

This commit is contained in:
Sergei Golubchik 2017-06-14 00:48:34 +02:00
parent 5cbbfe9f54
commit c661b4d0fb
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,6 @@
set sql_mode=ansi_quotes;
create table t1 (i int) partition by range (i) (partition flush values less than maxvalue);
set sql_mode=default;
lock tables t1 read local;
unlock tables;
drop table t1;

View File

@ -0,0 +1,10 @@
#
# MDEV-13017 LOCK TABLE fails with irrelevant error while working with tables affected by ANSI_QUOTES
#
--source include/have_partition.inc
set sql_mode=ansi_quotes;
create table t1 (i int) partition by range (i) (partition flush values less than maxvalue);
set sql_mode=default;
lock tables t1 read local;
unlock tables;
drop table t1;

View File

@ -1918,9 +1918,12 @@ static int add_name_string(File fptr, const char *name)
int err;
String name_string("", 0, system_charset_info);
THD *thd= current_thd;
ulonglong save_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~MODE_ANSI_QUOTES;
ulonglong save_options= thd->variables.option_bits;
thd->variables.option_bits&= ~OPTION_QUOTE_SHOW_CREATE;
append_identifier(thd, &name_string, name, strlen(name));
thd->variables.sql_mode= save_sql_mode;
thd->variables.option_bits= save_options;
err= add_string_object(fptr, &name_string);
return err;