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

parent 6ad94a6d
...@@ -295,4 +295,5 @@ ...@@ -295,4 +295,5 @@
#define ER_BAD_SLAVE_UNTIL_COND 1276 #define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277 #define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278 #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 ``; ...@@ -69,6 +69,8 @@ drop table if exists ``;
ERROR 42000: Incorrect table name '' ERROR 42000: Incorrect table name ''
create table t1 (`` int); create table t1 (`` int);
ERROR 42000: Incorrect column name '' ERROR 42000: Incorrect column name ''
create table t1 (i int, index `` (i));
ERROR HY000: Incorrect index name ''
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
Note 1051 Unknown table 't1' Note 1051 Unknown table 't1'
......
...@@ -72,6 +72,8 @@ create table `` (a int); ...@@ -72,6 +72,8 @@ create table `` (a int);
drop table if exists ``; drop table if exists ``;
--error 1166 --error 1166
create table t1 (`` int); create table t1 (`` int);
--error 1279
create table t1 (i int, index `` (i));
drop table if exists t1; drop table if exists t1;
# #
......
...@@ -291,3 +291,4 @@ character-set=latin2 ...@@ -291,3 +291,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -285,3 +285,4 @@ character-set=latin1 ...@@ -285,3 +285,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -293,3 +293,4 @@ character-set=latin1 ...@@ -293,3 +293,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=latin1 ...@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -287,3 +287,4 @@ character-set=latin7 ...@@ -287,3 +287,4 @@ character-set=latin7
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=latin1 ...@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -294,3 +294,4 @@ character-set=latin1 ...@@ -294,3 +294,4 @@ character-set=latin1
"Falscher Parameter oder falsche Kombination von Parametern für START SLAVE UNTIL", "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", "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" "SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=greek ...@@ -282,3 +282,4 @@ character-set=greek
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=latin2 ...@@ -284,3 +284,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=latin1 ...@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=ujis ...@@ -284,3 +284,4 @@ character-set=ujis
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=euckr ...@@ -282,3 +282,4 @@ character-set=euckr
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=latin1 ...@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=latin1 ...@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -286,3 +286,4 @@ character-set=latin2 ...@@ -286,3 +286,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -283,3 +283,4 @@ character-set=latin1 ...@@ -283,3 +283,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -286,3 +286,4 @@ character-set=latin2 ...@@ -286,3 +286,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=koi8r ...@@ -284,3 +284,4 @@ character-set=koi8r
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -277,3 +277,4 @@ character-set=cp1250 ...@@ -277,3 +277,4 @@ character-set=cp1250
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -290,3 +290,4 @@ character-set=latin2 ...@@ -290,3 +290,4 @@ character-set=latin2
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -284,3 +284,4 @@ character-set=latin1 ...@@ -284,3 +284,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -282,3 +282,4 @@ character-set=latin1 ...@@ -282,3 +282,4 @@ character-set=latin1
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "SQL thread is not to be started so UNTIL options are ignored"
"Incorrect index name '%-.100s'",
...@@ -287,3 +287,4 @@ character-set=koi8u ...@@ -287,3 +287,4 @@ character-set=koi8u
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "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" "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" "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, ...@@ -861,6 +861,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
key_info->name=(char*) key_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)) if (!(key_info->flags & HA_NULL_PART_KEY))
unique_key=1; unique_key=1;
key_info->key_length=(uint16) key_length; 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