summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-14 00:48:34 +0200
committerSergei Golubchik <serg@mariadb.org>2017-06-14 13:22:37 +0200
commitc661b4d0fb38c103fc0b659a95e8552ea72574cf (patch)
treeb65c4537a1a9bbaff61f56fb78b9de175a8bfab9
parent5cbbfe9f54f15a5281439dc21f22b599a69b5f87 (diff)
downloadmariadb-git-c661b4d0fb38c103fc0b659a95e8552ea72574cf.tar.gz
MDEV-13017 LOCK TABLE fails with irrelevant error while working with tables affected by ANSI_QUOTES
-rw-r--r--mysql-test/suite/parts/r/quoting.result6
-rw-r--r--mysql-test/suite/parts/t/quoting.test10
-rw-r--r--sql/sql_partition.cc3
3 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/suite/parts/r/quoting.result b/mysql-test/suite/parts/r/quoting.result
new file mode 100644
index 00000000000..ba6a155e6ac
--- /dev/null
+++ b/mysql-test/suite/parts/r/quoting.result
@@ -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;
diff --git a/mysql-test/suite/parts/t/quoting.test b/mysql-test/suite/parts/t/quoting.test
new file mode 100644
index 00000000000..297896fd9cf
--- /dev/null
+++ b/mysql-test/suite/parts/t/quoting.test
@@ -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;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 43f9797eb62..e6513fc7476 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -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;