summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-06-19 19:46:12 +0200
committerSergei Golubchik <serg@mariadb.org>2015-06-27 09:40:55 +0200
commit794a895c4c12bc45321c3c7000441204946d9129 (patch)
tree7daa7ad6bc74f74d785195dab574d634ccf54a39
parentbfabaf64866203b79b6ef251c89e31219ec05d9d (diff)
downloadmariadb-git-794a895c4c12bc45321c3c7000441204946d9129.tar.gz
simplify CREATE TEMPORARY TABLE parser rule
as a bonus that makes CREATE TEMPORARY TEMPORARY TABLE illegal
-rw-r--r--mysql-test/r/temp_table.result2
-rw-r--r--mysql-test/t/temp_table.test6
-rw-r--r--sql/sql_yacc.yy21
3 files changed, 11 insertions, 18 deletions
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result
index 0a1701be0d7..dca925040b0 100644
--- a/mysql-test/r/temp_table.result
+++ b/mysql-test/r/temp_table.result
@@ -291,3 +291,5 @@ test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
DROP TABLES t1, t2, t3;
+create temporary temporary table t1 (a int);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'temporary table t1 (a int)' at line 1
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
index f594f0c6c48..542a3487196 100644
--- a/mysql-test/t/temp_table.test
+++ b/mysql-test/t/temp_table.test
@@ -319,3 +319,9 @@ INSERT INTO t3 VALUES (101), (102), (103);
REPAIR TABLE t1, t2, t3;
DROP TABLES t1, t2, t3;
+
+#
+# CREATE TEMPORARY TEMPORARY TABLE
+#
+--error ER_PARSE_ERROR
+create temporary temporary table t1 (a int);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 49ae55dd862..a18cc2280d3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1717,8 +1717,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <num>
order_dir lock_option
- udf_type opt_local opt_table_options table_options
- table_option opt_no_write_to_binlog
+ udf_type opt_local opt_no_write_to_binlog
opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options union_option
opt_not opt_union_order_or_limit
@@ -2444,7 +2443,7 @@ connection_name:
/* create a table */
create:
- create_or_replace opt_table_options TABLE_SYM opt_if_not_exists table_ident
+ create_or_replace opt_temporary TABLE_SYM opt_if_not_exists table_ident
{
LEX *lex= thd->lex;
lex->create_info.init();
@@ -5578,20 +5577,6 @@ create_database_option:
| default_charset {}
;
-opt_table_options:
- /* empty */ { $$= 0; }
- | table_options { $$= $1;}
- ;
-
-table_options:
- table_option { $$=$1; }
- | table_option table_options { $$= $1 | $2; }
- ;
-
-table_option:
- TEMPORARY { $$=HA_LEX_CREATE_TMP_TABLE; }
- ;
-
opt_if_not_exists_table_element:
/* empty */
{
@@ -11960,7 +11945,7 @@ opt_if_exists:
opt_temporary:
/* empty */ { $$= 0; }
- | TEMPORARY { $$= HA_LEX_CREATE_TMP_TABLE;; }
+ | TEMPORARY { $$= HA_LEX_CREATE_TMP_TABLE; }
;
/*
** Insert : add new data to table