diff options
-rw-r--r-- | client/mysqldump.c | 2 | ||||
-rw-r--r-- | myisam/myisamchk.c | 4 | ||||
-rw-r--r-- | mysql-test/r/create.result | 6 | ||||
-rw-r--r-- | mysql-test/r/derived.result | 2 | ||||
-rw-r--r-- | mysql-test/r/func_str.result | 2 | ||||
-rw-r--r-- | mysql-test/r/rpl_multi_delete2.result | 8 | ||||
-rw-r--r-- | mysql-test/r/rpl_server_id1.result | 9 | ||||
-rw-r--r-- | mysql-test/t/derived.test | 2 | ||||
-rw-r--r-- | mysql-test/t/innodb-lock.test | 3 | ||||
-rw-r--r-- | mysql-test/t/rpl_server_id1.test | 1 | ||||
-rw-r--r-- | mysql-test/t/union.test | 8 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 5 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/sql_acl.cc | 11 | ||||
-rw-r--r-- | sql/sql_select.cc | 20 | ||||
-rw-r--r-- | sql/sql_union.cc | 4 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 9 |
18 files changed, 60 insertions, 42 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index ba0b5d42a0e..1a0ef713ec7 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -904,7 +904,7 @@ static uint getTableStructure(char *table, char* db) sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d", (opt_quoted || opt_keywords)); if (!create_options) - strmov(strend(insert_pat), "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 'NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */"); + strmov(strend(insert_pat), "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 ',NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */"); result_table= quote_name(table, table_buff, 1); opt_quoted_table= quote_name(table, table_buff2, 0); diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 3bbeac00754..135797b8ff0 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -328,11 +328,11 @@ static struct my_option my_long_options[] = { "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len, (gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10, HA_FT_MAXCHARLEN, 0, 1, 0}, - { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, { "ft_stopword_file", OPT_FT_STOPWORD_FILE, "Use stopwords from this file instead of built-in list.", (gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index f2b33f2325e..b5f7da30bb3 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -275,11 +275,11 @@ ERROR 42000: Incorrect database name 'db1 ' create table t1(`a ` int); ERROR 42000: Incorrect column name 'a ' create table t1 (a int,); -You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 create table t1 (a int,,b int); -You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1 +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1 create table t1 (,b int); -You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1 +ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'b int)' at line 1 create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index f5754bb3332..81e2cd03d1a 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -251,7 +251,7 @@ id select_type table type possible_keys key key_len ref rows Extra drop table t1; CREATE TABLE `t1` ( `N` int(11) unsigned NOT NULL default '0', -`M` tinyint(1) default '0', +`M` tinyint(1) default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0); UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2; diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index fb0cdbbb651..9904242b3e0 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -281,7 +281,7 @@ CREATE TABLE t1 ( wid int(10) unsigned NOT NULL auto_increment, data_podp date default NULL, status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy', -PRIMARY KEY(wid), +PRIMARY KEY(wid) ); INSERT INTO t1 VALUES (8,NULL,'real'); INSERT INTO t1 VALUES (9,NULL,'nowy'); diff --git a/mysql-test/r/rpl_multi_delete2.result b/mysql-test/r/rpl_multi_delete2.result index 8b6d87801fe..c6c088111fc 100644 --- a/mysql-test/r/rpl_multi_delete2.result +++ b/mysql-test/r/rpl_multi_delete2.result @@ -1,9 +1,9 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; create table t1 (a int); create table t2 (a int); insert into t1 values (1); @@ -15,7 +15,7 @@ select * from t2; a 1 select * from t1; -Table 'test.t1' doesn't exist +ERROR 42S02: Table 'test.t1' doesn't exist select * from t2; -Table 'test.t2' doesn't exist +ERROR 42S02: Table 'test.t2' doesn't exist drop table t1,t2; diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result index d8b23b9ca41..8c383802de4 100644 --- a/mysql-test/r/rpl_server_id1.result +++ b/mysql-test/r/rpl_server_id1.result @@ -1,17 +1,16 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; -drop table if exists t1; +start slave; create table t1 (n int); reset master; stop slave; change master to master_port=SLAVE_PORT; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 # +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 4 None 0 No NULL start slave; insert into t1 values (1); show status like "slave_running"; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index f0d5a253bf4..fbfd3ccdef1 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -146,7 +146,7 @@ drop table t1; # CREATE TABLE `t1` ( `N` int(11) unsigned NOT NULL default '0', - `M` tinyint(1) default '0', + `M` tinyint(1) default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0); UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2; diff --git a/mysql-test/t/innodb-lock.test b/mysql-test/t/innodb-lock.test index 43a175508b4..33baec32549 100644 --- a/mysql-test/t/innodb-lock.test +++ b/mysql-test/t/innodb-lock.test @@ -2,7 +2,10 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); + +--disable_warnings drop table if exists t1; +--enable_warnings # # Testing of explicit table locks diff --git a/mysql-test/t/rpl_server_id1.test b/mysql-test/t/rpl_server_id1.test index 1bd4d9547c7..aefcb81c930 100644 --- a/mysql-test/t/rpl_server_id1.test +++ b/mysql-test/t/rpl_server_id1.test @@ -3,7 +3,6 @@ source include/master-slave.inc; connection slave; -drop table if exists t1; create table t1 (n int); reset master; # replicate ourselves diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index effb0139111..5d84d9a364a 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -469,12 +469,13 @@ show status like 'Slow_queries'; drop table t1; # -# bug #2508 +# Column 'name' cannot be null (error with union and left join) (bug #2508) # create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM; insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777'); select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null); drop table t1; + # # Bug #2809 (UNION fails on MyIsam tables when index on second column from # same table) @@ -487,10 +488,8 @@ select col1 n from t1 union select col2 n from t1 order by n; drop table t1; # -# Bug #1428, incorrect handling of UNION ALL -# NOTE: The current result is wrong, needs to be fixed! +# Incorrect handling of UNION ALL (Bug #1428) # - create table t1 (i int); insert into t1 values (1); select * from t1 UNION select * from t1; @@ -503,4 +502,3 @@ select 1 union select 2; (select 1) union (select 2); (select 1) union (select 2) union (select 3) limit 2; set sql_select_limit=default; - diff --git a/sql/item.cc b/sql/item.cc index 98e6f02efad..f1569b6dca6 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1355,7 +1355,7 @@ int Item::save_in_field(Field *field, bool no_conversions) result=val_str(&str_value); if (null_value) { - str_value.set_quick(0, 0); + str_value.set_quick(0, 0, cs); return set_field_to_null_with_conversions(field, no_conversions); } field->set_notnull(); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index f22c14c925f..0c0b5265db7 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -635,7 +635,8 @@ bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time, */ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, - uint count, long *values, bool transform_msec) + uint count, ulonglong *values, + bool transform_msec) { const char *end=str+length; uint i; @@ -1651,7 +1652,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, uint fuzzy_date) sec=((ltime->day-1)*3600*24L+ltime->hour*3600+ltime->minute*60+ ltime->second + sign* (longlong) (interval.day*3600*24L + - interval.hour*3600+interval.minute*60+ + interval.hour*LL(3600)+interval.minute*LL(60)+ interval.second))+ extra_sec; if (microseconds < 0) { diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c231ec0e024..2d2514b0017 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2328,6 +2328,7 @@ Warning: you need to use --log-bin to make --log-slave-updates work. \ Now disabling --log-slave-updates."); } +#ifdef HAVE_REPLICATION if (opt_log_slave_updates && replicate_same_server_id) { sql_print_error("\ @@ -2336,6 +2337,7 @@ Error: using --replicate-same-server-id in conjunction with \ server."); unireg_abort(1); } +#endif if (opt_error_log) { @@ -4099,6 +4101,7 @@ master-ssl", {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB, "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#ifdef HAVE_REPLICATION {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID, "In replication, if set to 1, do not skip events having our server id. \ Default value is 0 (to break infinite loops in circular replication). \ @@ -4106,6 +4109,7 @@ Can't be set to 1 if --log-slave-updates is used.", (gptr*) &replicate_same_server_id, (gptr*) &replicate_same_server_id, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif // In replication, we may need to tell the other servers how to connect {"report-host", OPT_REPORT_HOST, "Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.", diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 625068e655c..27aaf06d872 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3015,6 +3015,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables"); DBUG_RETURN(-1); } + + if (!lex_user->host.str) + { + lex_user->host.str= (char*) "%"; + lex_user->host.length=1; + } if (lex_user->host.length > HOSTNAME_LENGTH || lex_user->user.length > USERNAME_LENGTH) { @@ -3215,7 +3221,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) /* Add table & column access */ for (index=0 ; index < column_priv_hash.records ; index++) { - const char *user,*host; + const char *user; GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, index); @@ -3223,7 +3229,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) user= ""; if (!strcmp(lex_user->user.str,user) && - !my_strcasecmp(&my_charset_latin1, lex_user->host.str, host)) + !my_strcasecmp(&my_charset_latin1, lex_user->host.str, + grant_table->orig_host)) { ulong table_access= grant_table->privs; if ((table_access | grant_table->cols) != 0) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ffc52817322..2cfeb171153 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -256,15 +256,19 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, ORDER *order, ORDER *group, bool *hidden_group_fields) { - bool save_allow_sum_func= thd->allow_sum_func; + bool save_allow_sum_func; + int res; + DBUG_ENTER("setup_without_group"); + + save_allow_sum_func= thd->allow_sum_func; thd->allow_sum_func= 0; - int res= (setup_conds(thd, tables, conds) || - setup_order(thd, ref_pointer_array, tables, fields, all_fields, - order) || - setup_group(thd, ref_pointer_array, tables, fields, all_fields, - group, hidden_group_fields)); + res= (setup_conds(thd, tables, conds) || + setup_order(thd, ref_pointer_array, tables, fields, all_fields, + order) || + setup_group(thd, ref_pointer_array, tables, fields, all_fields, + group, hidden_group_fields)); thd->allow_sum_func= save_allow_sum_func; - return res; + DBUG_RETURN(res); } /***************************************************************************** @@ -273,7 +277,7 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array, *****************************************************************************/ /* - Prepare of whole select (including subselect in future). + Prepare of whole select (including sub queries in future). return -1 on error 0 on success */ diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 1b3995f30be..cffbece2f18 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -367,8 +367,6 @@ int st_select_lex_unit::exec() optimized= 1; /* Send result to 'result' */ - - res= -1; { List<Item_func_match> empty_list; @@ -405,7 +403,7 @@ int st_select_lex_unit::exec() if (!join) { /* - allocate JOIN for fake select only once (privent + allocate JOIN for fake select only once (prevent mysql_select automatic allocation) */ if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 86b4702d314..39a2e980094 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -603,7 +603,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %type <simple_string> remember_name remember_end opt_ident opt_db text_or_password - opt_escape opt_constraint + opt_escape opt_constraint constraint %type <string> text_string opt_gconcat_separator @@ -1229,7 +1229,12 @@ check_constraint: opt_constraint: /* empty */ { $$=(char*) 0; } - | CONSTRAINT opt_ident { $$=$2; }; + | constraint { $$= $1; } + ; + +constraint: + CONSTRAINT opt_ident { $$=$2; } + ; field_spec: field_ident |