Commit ff50211d authored by unknown's avatar unknown

added checking for empty index name (fixed bug #1419)


include/mysqld_error.h:
  added error "Incorrect index name"
mysql-test/r/create.result:
  added test for empty index name
mysql-test/t/create.test:
  added test for empty index name
sql/share/czech/errmsg.txt:
  added error "Incorrect index name"
sql/share/danish/errmsg.txt:
  added error "Incorrect index name"
sql/share/dutch/errmsg.txt:
  added error "Incorrect index name"
sql/share/english/errmsg.txt:
  added error "Incorrect index name"
sql/share/estonian/errmsg.txt:
  added error "Incorrect index name"
sql/share/french/errmsg.txt:
  added error "Incorrect index name"
sql/share/german/errmsg.txt:
  added error "Incorrect index name"
sql/share/greek/errmsg.txt:
  added error "Incorrect index name"
sql/share/hungarian/errmsg.txt:
  added error "Incorrect index name"
sql/share/italian/errmsg.txt:
  added error "Incorrect index name"
sql/share/japanese/errmsg.txt:
  added error "Incorrect index name"
sql/share/korean/errmsg.txt:
  added error "Incorrect index name"
sql/share/norwegian-ny/errmsg.txt:
  added error "Incorrect index name"
sql/share/norwegian/errmsg.txt:
  added error "Incorrect index name"
sql/share/polish/errmsg.txt:
  added error "Incorrect index name"
sql/share/portuguese/errmsg.txt:
  added error "Incorrect index name"
sql/share/romanian/errmsg.txt:
  added error "Incorrect index name"
sql/share/russian/errmsg.txt:
  added error "Incorrect index name"
sql/share/serbian/errmsg.txt:
  added error "Incorrect index name"
sql/share/slovak/errmsg.txt:
  added error "Incorrect index name"
sql/share/spanish/errmsg.txt:
  added error "Incorrect index name"
sql/share/swedish/errmsg.txt:
  added error "Incorrect index name"
sql/share/ukrainian/errmsg.txt:
  added error "Incorrect index name"
sql/sql_table.cc:
  added checking for wrong index name
parent e83a7c2c
......@@ -295,4 +295,5 @@
#define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278
#define ER_ERROR_MESSAGES 279
#define ER_WRONG_INDEX_NAME 1279
#define ER_ERROR_MESSAGES 280
......@@ -69,6 +69,8 @@ drop table if exists ``;
ERROR 42000: Incorrect table name ''
create table t1 (`` int);
ERROR 42000: Incorrect column name ''
create table t1 (i int, index `` (i));
ERROR HY000: Incorrect index name ''
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
......
......@@ -72,6 +72,8 @@ create table `` (a int);
drop table if exists ``;
--error 1166
create table t1 (`` int);
--error 1279
create table t1 (i int, index `` (i));
drop table if exists t1;
#
......
......@@ -291,3 +291,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -285,3 +285,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -293,3 +293,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -287,3 +287,4 @@ character-set=latin7
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -294,3 +294,4 @@ character-set=latin1
"Falscher Parameter oder falsche Kombination von Parametern für START SLAVE UNTIL",
"Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet",
"SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=greek
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=ujis
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=euckr
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -286,3 +286,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -283,3 +283,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -286,3 +286,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=koi8r
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -277,3 +277,4 @@ character-set=cp1250
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -290,3 +290,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -287,3 +287,4 @@ character-set=koi8u
"Wrong parameter or combination of parameters for START SLAVE UNTIL"
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart"
"SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
......@@ -861,6 +861,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
key_info->name=(char*) key_name;
}
}
if (!key_info->name || check_column_name(key_info->name))
{
my_error(ER_WRONG_INDEX_NAME, MYF(0), key_info->name);
DBUG_RETURN(-1);
}
if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1;
key_info->key_length=(uint16) key_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment