Skip to content

Commit

Permalink
MDEV-13017 LOCK TABLE fails with irrelevant error while working with …
Browse files Browse the repository at this point in the history
…tables affected by ANSI_QUOTES
  • Loading branch information
vuvova committed Jun 14, 2017
1 parent 5cbbfe9 commit c661b4d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mysql-test/suite/parts/r/quoting.result
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 10 additions & 0 deletions mysql-test/suite/parts/t/quoting.test
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 3 additions & 0 deletions sql/sql_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c661b4d

Please sign in to comment.