diff options
author | unknown <ingo@mysql.com> | 2005-05-31 20:55:42 +0200 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2005-05-31 20:55:42 +0200 |
commit | 10481cd0368cb2ae07efd0f05c65748c3046eff8 (patch) | |
tree | c8a1aaa42184d0f52eccf201d0e8c05c2eef83f2 | |
parent | 601b5bca66da5bb7108a13dc55984312f8396475 (diff) | |
parent | e0fbac193103f528e6991b0f51ad79d9acee6e17 (diff) | |
download | mariadb-git-10481cd0368cb2ae07efd0f05c65748c3046eff8.tar.gz |
Merge
mysql-test/r/create.result:
SCCS merged
mysql-test/t/create.test:
SCCS merged
-rw-r--r-- | mysql-test/r/create.result | 9 | ||||
-rw-r--r-- | mysql-test/t/create.test | 13 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 26 |
3 files changed, 47 insertions, 1 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index cd8378a504d..a504823a2a9 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -572,3 +572,12 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause flush tables with read lock; unlock tables; drop table t1; +create table t1(column.name int); +ERROR 42000: Incorrect table name 'column' +create table t1(test.column.name int); +ERROR 42000: Incorrect table name 'column' +create table t1(xyz.t1.name int); +ERROR 42000: Incorrect database name 'xyz' +create table t1(t1.name int); +create table t2(test.t2.name int); +drop table t1,t2; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index c37fccef70b..c6973b271ad 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -477,3 +477,16 @@ create table t2 union = (t1) select * from t1; flush tables with read lock; unlock tables; drop table t1; + +# +# Bug#10413: Invalid column name is not rejected +# +--error 1103 +create table t1(column.name int); +--error 1103 +create table t1(test.column.name int); +--error 1102 +create table t1(xyz.t1.name int); +create table t1(t1.name int); +create table t2(test.t2.name int); +drop table t1,t2; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d8a2c997bf8..7585f0b10a0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5016,7 +5016,31 @@ simple_ident: field_ident: ident { $$=$1;} - | ident '.' ident { $$=$3;} /* Skip schema name in create*/ + | ident '.' ident '.' ident + { + TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first; + if (my_strcasecmp(table_alias_charset, $1.str, table->db)) + { + net_printf(YYTHD, ER_WRONG_DB_NAME, $1.str); + YYABORT; + } + if (my_strcasecmp(table_alias_charset, $3.str, table->real_name)) + { + net_printf(YYTHD, ER_WRONG_TABLE_NAME, $3.str); + YYABORT; + } + $$=$5; + } + | ident '.' ident + { + TABLE_LIST *table= (TABLE_LIST*) Select->table_list.first; + if (my_strcasecmp(table_alias_charset, $1.str, table->alias)) + { + net_printf(YYTHD, ER_WRONG_TABLE_NAME, $1.str); + YYABORT; + } + $$=$3; + } | '.' ident { $$=$2;} /* For Delphi */; table_ident: |