From 9590918851d39f323e66514638226993fc034abd Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Apr 2008 03:27:14 +0400 Subject: [PATCH] Fix create.test in --ps-protocol broken by the previous push. sql/sql_table.cc: Fix create.test in --ps-protocol broken by the previous push, that added prepared statement validation of CREATE TABLE LIKE: move assignment of src_table->required_type to the parser. sql/sql_yacc.yy: Fix create.test in --ps-protocol broken by the previous push, that added prepared statement validation of CREATE TABLE LIKE: move assignment of src_table->required_type to the parser. --- sql/sql_table.cc | 3 --- sql/sql_yacc.yy | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f69f5fadff3..4997f99fd3a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4775,9 +4775,6 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, DBUG_ENTER("mysql_create_like_table"); - /* CREATE TABLE ... LIKE is not allowed for views. */ - src_table->required_type= FRMTYPE_TABLE; - /* By opening source table we guarantee that it exists and no concurrent DDL operation will mess with it. Later we also take an exclusive diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5e28bdb45e8..37f29a44644 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3577,20 +3577,30 @@ create2: | LIKE table_ident { THD *thd= YYTHD; + TABLE_LIST *src_table; LEX *lex= thd->lex; lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; - if (!lex->select_lex.add_table_to_list(thd, $2, NULL, 0, TL_READ)) + src_table= lex->select_lex.add_table_to_list(thd, $2, NULL, 0, + TL_READ); + if (! src_table) MYSQL_YYABORT; + /* CREATE TABLE ... LIKE is not allowed for views. */ + src_table->required_type= FRMTYPE_TABLE; } | '(' LIKE table_ident ')' { THD *thd= YYTHD; + TABLE_LIST *src_table; LEX *lex= thd->lex; lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; - if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0, TL_READ)) + src_table= lex->select_lex.add_table_to_list(thd, $3, NULL, 0, + TL_READ); + if (! src_table) MYSQL_YYABORT; + /* CREATE TABLE ... LIKE is not allowed for views. */ + src_table->required_type= FRMTYPE_TABLE; } ;