diff options
-rw-r--r-- | include/myisam.h | 4 | ||||
-rw-r--r-- | myisam/mi_check.c | 6 | ||||
-rw-r--r-- | myisam/sort.c | 4 | ||||
-rw-r--r-- | mysql-test/r/bdb-crash.result | 2 | ||||
-rw-r--r-- | mysql-test/r/group_by.result | 10 | ||||
-rw-r--r-- | mysql-test/r/join_outer.result | 14 | ||||
-rw-r--r-- | mysql-test/r/order_by.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_blob.result | 8 | ||||
-rw-r--r-- | mysql-test/r/type_decimal.result | 2 | ||||
-rw-r--r-- | mysql-test/r/type_ranges.result | 4 | ||||
-rw-r--r-- | mysql-test/r/update.result | 2 | ||||
-rw-r--r-- | mysql-test/t/bdb-crash.test | 2 | ||||
-rw-r--r-- | mysql-test/t/group_by.test | 10 | ||||
-rw-r--r-- | mysql-test/t/join_outer.test | 14 | ||||
-rw-r--r-- | mysql-test/t/order_by.test | 2 | ||||
-rw-r--r-- | mysql-test/t/type_blob.test | 8 | ||||
-rw-r--r-- | mysql-test/t/type_decimal.test | 2 | ||||
-rw-r--r-- | mysql-test/t/type_ranges.test | 4 | ||||
-rw-r--r-- | mysql-test/t/update.test | 2 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 24 | ||||
-rw-r--r-- | support-files/MacOSX/ReadMe.txt | 2 |
22 files changed, 79 insertions, 53 deletions
diff --git a/include/myisam.h b/include/myisam.h index def8b492681..11dae5f59ba 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -366,14 +366,18 @@ typedef struct st_sort_info SORT_KEY_BLOCKS *key_block,*key_block_end; /* sync things*/ uint got_error, threads_running; +#ifdef THREAD pthread_mutex_t mutex; pthread_cond_t cond; +#endif } SORT_INFO; typedef struct st_mi_sort_param { +#ifdef THREAD pthread_t thr; +#endif IO_CACHE read_cache, tempfile, tempfile_for_exceptions; DYNAMIC_ARRAY buffpek; ulonglong unique[MI_MAX_KEY_SEG+1]; diff --git a/myisam/mi_check.c b/myisam/mi_check.c index ca5c8f9ecb4..5cbe0a7d2f3 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -2109,7 +2109,7 @@ err: Threaded repair of table using sorting SYNOPSIS - mi_repair_by_sort_r() + mi_repair_parallel() param Repair parameters info MyISAM handler to repair name Name of table (for warnings) @@ -2128,6 +2128,9 @@ err: int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, const char * name, int rep_quick) { +#ifndef THREAD + return mi_repair_by_sort(param, info, name, rep_quick); +#else int got_error; uint i,key, total_key_length, istep; ulong rec_length; @@ -2489,6 +2492,7 @@ err: share->pack.header_length=0; } DBUG_RETURN(got_error); +#endif /* THREAD */ } /* Read next record and return next key */ diff --git a/myisam/sort.c b/myisam/sort.c index f45ecbaf3a1..ddf565d5092 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -275,6 +275,7 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, } /* find_all_keys */ +#ifdef THREAD /* Search after all keys and place them in a temp. file */ pthread_handler_decl(thr_find_all_keys,arg) @@ -284,7 +285,7 @@ pthread_handler_decl(thr_find_all_keys,arg) uint memavl,old_memavl,keys,sort_length; uint idx, maxbuffer; uchar **sort_keys=0; - + error=1; if (my_thread_init()) @@ -542,6 +543,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) my_free((gptr) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); return got_error; } +#endif /* THREAD */ /* Write all keys in memory to file for later merge */ diff --git a/mysql-test/r/bdb-crash.result b/mysql-test/r/bdb-crash.result index 42c826d55da..5079368ea21 100644 --- a/mysql-test/r/bdb-crash.result +++ b/mysql-test/r/bdb-crash.result @@ -1,6 +1,6 @@ drop table if exists t1; CREATE TABLE t1 ( -ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, +ChargeID int(10) unsigned NOT NULL auto_increment, ServiceID int(10) unsigned DEFAULT '0' NOT NULL, ChargeDate date DEFAULT '0000-00-00' NOT NULL, ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL, diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 91f33e0cd9f..0694e284115 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -11,7 +11,7 @@ INSERT INTO t1 VALUES (2,2,2,'','0000-00-00'); INSERT INTO t1 VALUES (2,1,1,'','0000-00-00'); INSERT INTO t1 VALUES (3,3,3,'','0000-00-00'); CREATE TABLE t2 ( -userID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, +userID int(10) unsigned NOT NULL auto_increment, niName char(15), passwd char(8), mail char(50), @@ -51,7 +51,7 @@ userid MIN(t1.score+0.0) 2 2.0 drop table test.t1,test.t2; CREATE TABLE t1 ( -PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, +PID int(10) unsigned NOT NULL auto_increment, payDate date DEFAULT '0000-00-00' NOT NULL, recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, URID int(10) unsigned DEFAULT '0' NOT NULL, @@ -74,7 +74,7 @@ SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 Can't group on 'IsNew' drop table t1; CREATE TABLE t1 ( -cid mediumint(9) DEFAULT '0' NOT NULL auto_increment, +cid mediumint(9) NOT NULL auto_increment, firstname varchar(32) DEFAULT '' NOT NULL, surname varchar(32) DEFAULT '' NOT NULL, PRIMARY KEY (cid) @@ -82,7 +82,7 @@ PRIMARY KEY (cid) INSERT INTO t1 VALUES (1,'That','Guy'); INSERT INTO t1 VALUES (2,'Another','Gent'); CREATE TABLE t2 ( -call_id mediumint(8) DEFAULT '0' NOT NULL auto_increment, +call_id mediumint(8) NOT NULL auto_increment, contact_id mediumint(8) DEFAULT '0' NOT NULL, PRIMARY KEY (call_id), KEY contact_id (contact_id) @@ -102,7 +102,7 @@ cid CONCAT(firstname, ' ', surname) COUNT(call_id) drop table t1,t2; unlock tables; CREATE TABLE t1 ( -bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment, +bug_id mediumint(9) NOT NULL auto_increment, groupset bigint(20) DEFAULT '0' NOT NULL, assigned_to mediumint(9) DEFAULT '0' NOT NULL, bug_file_loc text, diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 37e18b8b304..6e69616b7c6 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -235,7 +235,7 @@ INSERT INTO t2 VALUES (11410,11410,131,0); INSERT INTO t2 VALUES (11416,11416,32767,0); INSERT INTO t2 VALUES (11409,0,0,0); CREATE TABLE t3 ( -id int(11) DEFAULT '0' NOT NULL auto_increment, +id int(11) NOT NULL auto_increment, dni_pasaporte char(16) DEFAULT '' NOT NULL, idPla int(11) DEFAULT '0' NOT NULL, cod_asig int(11) DEFAULT '0' NOT NULL, @@ -248,7 +248,7 @@ UNIQUE dni_pasaporte_2 (dni_pasaporte,idPla,cod_asig,any,quatrimestre) ); INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M'); CREATE TABLE t4 ( -id int(11) DEFAULT '0' NOT NULL auto_increment, +id int(11) NOT NULL auto_increment, papa int(11) DEFAULT '0' NOT NULL, fill int(11) DEFAULT '0' NOT NULL, idPla int(11) DEFAULT '0' NOT NULL, @@ -285,7 +285,7 @@ fill idPla 10362 NULL drop table t1,t2,t3,test.t4; CREATE TABLE t1 ( -id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment, +id smallint(5) unsigned NOT NULL auto_increment, name char(60) DEFAULT '' NOT NULL, PRIMARY KEY (id) ); @@ -293,7 +293,7 @@ INSERT INTO t1 VALUES (1,'Antonio Paz'); INSERT INTO t1 VALUES (2,'Lilliana Angelovska'); INSERT INTO t1 VALUES (3,'Thimble Smith'); CREATE TABLE t2 ( -id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment, +id smallint(5) unsigned NOT NULL auto_increment, owner smallint(5) unsigned DEFAULT '0' NOT NULL, name char(60), PRIMARY KEY (id) @@ -383,15 +383,15 @@ id str 2 NULL drop table t1; CREATE TABLE t1 ( -t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t1_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t1_id) ); CREATE TABLE t2 ( -t2_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t2_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t2_id) ); CREATE TABLE t3 ( -t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t3_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t3_id) ); CREATE TABLE t4 ( diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 9238d9eafcb..79c6c9fa6fb 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (2,6,'60671515','Y'); INSERT INTO t1 VALUES (2,7,'60671569','Y'); INSERT INTO t1 VALUES (2,3,'dd','Y'); CREATE TABLE t2 ( -id int(6) DEFAULT '0' NOT NULL auto_increment, +id int(6) NOT NULL auto_increment, description varchar(40) NOT NULL, idform varchar(40), ordre int(6) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index ab4723457d1..d7c41743bf3 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -315,7 +315,7 @@ Incorrect sub part key. The used key part isn't a string, the used length is lon create table t1 (a text, key (a(255))); drop table t1; CREATE TABLE t1 ( -t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t1_id bigint(21) NOT NULL auto_increment, _field_72 varchar(128) DEFAULT '' NOT NULL, _field_95 varchar(32), _field_115 tinyint(4) DEFAULT '0' NOT NULL, @@ -339,7 +339,7 @@ INSERT INTO t2 VALUES (1,1); INSERT INTO t2 VALUES (2,1); INSERT INTO t2 VALUES (2,2); CREATE TABLE t3 ( -t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t3_id bigint(21) NOT NULL auto_increment, _field_131 varchar(128), _field_133 tinyint(4) DEFAULT '0' NOT NULL, _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, @@ -367,7 +367,7 @@ PRIMARY KEY (seq_0_id,seq_1_id) INSERT INTO t4 VALUES (1,1); INSERT INTO t4 VALUES (2,1); CREATE TABLE t5 ( -t5_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t5_id bigint(21) NOT NULL auto_increment, _field_149 tinyint(4), _field_156 varchar(128) DEFAULT '' NOT NULL, _field_157 varchar(128) DEFAULT '' NOT NULL, @@ -394,7 +394,7 @@ INSERT INTO t6 VALUES (1,1); INSERT INTO t6 VALUES (1,2); INSERT INTO t6 VALUES (2,2); CREATE TABLE t7 ( -t7_id bigint(21) DEFAULT '0' NOT NULL auto_increment, +t7_id bigint(21) NOT NULL auto_increment, _field_143 tinyint(4), _field_165 varchar(32), _field_166 smallint(6) DEFAULT '0' NOT NULL, diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 0e60eefc9c7..4c326957c03 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -1,6 +1,6 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( -id int(11) DEFAULT '0' NOT NULL auto_increment, +id int(11) NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL, maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL, diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index fc7cc5255cf..4f4b4eb43eb 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -1,6 +1,6 @@ drop table if exists t1,t2,t3; CREATE TABLE t1 ( -auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment, +auto int(5) unsigned NOT NULL auto_increment, string char(10) default "hello", tiny tinyint(4) DEFAULT '0' NOT NULL , short smallint(6) DEFAULT '1' NOT NULL , @@ -129,7 +129,7 @@ auto new_field new_blob_col date_field 15 new 4294967295 0000-00-00 16 new NULL NULL CREATE TABLE t2 ( -auto int(5) unsigned NOT NULL DEFAULT 0 auto_increment, +auto int(5) unsigned NOT NULL auto_increment, string char(20), mediumblob_col mediumblob not null, new_field char(2), diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index ba5c1c6e28f..db209c5855c 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -96,7 +96,7 @@ KEY k4 (assignment), KEY ticket (ticket) ) TYPE=MyISAM; INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); -alter table t1 change lfdnr lfdnr int(10) unsigned default 0 not null auto_increment; +alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment; update t1 set status=1 where type='Open'; select status from t1; status diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index 0005b631a46..4575a612728 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -4,7 +4,7 @@ drop table if exists t1; CREATE TABLE t1 ( - ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + ChargeID int(10) unsigned NOT NULL auto_increment, ServiceID int(10) unsigned DEFAULT '0' NOT NULL, ChargeDate date DEFAULT '0000-00-00' NOT NULL, ChargeAmount decimal(20,2) DEFAULT '0.00' NOT NULL, diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index ab5d6062daf..5875f9a9ba9 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -17,7 +17,7 @@ INSERT INTO t1 VALUES (2,1,1,'','0000-00-00'); INSERT INTO t1 VALUES (3,3,3,'','0000-00-00'); CREATE TABLE t2 ( - userID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + userID int(10) unsigned NOT NULL auto_increment, niName char(15), passwd char(8), mail char(50), @@ -47,7 +47,7 @@ drop table test.t1,test.t2; # CREATE TABLE t1 ( - PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, + PID int(10) unsigned NOT NULL auto_increment, payDate date DEFAULT '0000-00-00' NOT NULL, recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, URID int(10) unsigned DEFAULT '0' NOT NULL, @@ -79,7 +79,7 @@ drop table t1; # CREATE TABLE t1 ( - cid mediumint(9) DEFAULT '0' NOT NULL auto_increment, + cid mediumint(9) NOT NULL auto_increment, firstname varchar(32) DEFAULT '' NOT NULL, surname varchar(32) DEFAULT '' NOT NULL, PRIMARY KEY (cid) @@ -88,7 +88,7 @@ INSERT INTO t1 VALUES (1,'That','Guy'); INSERT INTO t1 VALUES (2,'Another','Gent'); CREATE TABLE t2 ( - call_id mediumint(8) DEFAULT '0' NOT NULL auto_increment, + call_id mediumint(8) NOT NULL auto_increment, contact_id mediumint(8) DEFAULT '0' NOT NULL, PRIMARY KEY (call_id), KEY contact_id (contact_id) @@ -114,7 +114,7 @@ unlock tables; # CREATE TABLE t1 ( - bug_id mediumint(9) DEFAULT '0' NOT NULL auto_increment, + bug_id mediumint(9) NOT NULL auto_increment, groupset bigint(20) DEFAULT '0' NOT NULL, assigned_to mediumint(9) DEFAULT '0' NOT NULL, bug_file_loc text, diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index af5f377afb5..71c3643b2f4 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -168,7 +168,7 @@ INSERT INTO t2 VALUES (11416,11416,32767,0); INSERT INTO t2 VALUES (11409,0,0,0); CREATE TABLE t3 ( - id int(11) DEFAULT '0' NOT NULL auto_increment, + id int(11) NOT NULL auto_increment, dni_pasaporte char(16) DEFAULT '' NOT NULL, idPla int(11) DEFAULT '0' NOT NULL, cod_asig int(11) DEFAULT '0' NOT NULL, @@ -183,7 +183,7 @@ CREATE TABLE t3 ( INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M'); CREATE TABLE t4 ( - id int(11) DEFAULT '0' NOT NULL auto_increment, + id int(11) NOT NULL auto_increment, papa int(11) DEFAULT '0' NOT NULL, fill int(11) DEFAULT '0' NOT NULL, idPla int(11) DEFAULT '0' NOT NULL, @@ -210,7 +210,7 @@ drop table t1,t2,t3,test.t4; # CREATE TABLE t1 ( - id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment, + id smallint(5) unsigned NOT NULL auto_increment, name char(60) DEFAULT '' NOT NULL, PRIMARY KEY (id) ); @@ -219,7 +219,7 @@ INSERT INTO t1 VALUES (2,'Lilliana Angelovska'); INSERT INTO t1 VALUES (3,'Thimble Smith'); CREATE TABLE t2 ( - id smallint(5) unsigned DEFAULT '0' NOT NULL auto_increment, + id smallint(5) unsigned NOT NULL auto_increment, owner smallint(5) unsigned DEFAULT '0' NOT NULL, name char(60), PRIMARY KEY (id) @@ -257,15 +257,15 @@ drop table t1; # CREATE TABLE t1 ( - t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t1_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t1_id) ); CREATE TABLE t2 ( - t2_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t2_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t2_id) ); CREATE TABLE t3 ( - t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t3_id bigint(21) NOT NULL auto_increment, PRIMARY KEY (t3_id) ); CREATE TABLE t4 ( diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 8291a475d5e..06a5d0ceb20 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -23,7 +23,7 @@ INSERT INTO t1 VALUES (2,7,'60671569','Y'); INSERT INTO t1 VALUES (2,3,'dd','Y'); CREATE TABLE t2 ( - id int(6) DEFAULT '0' NOT NULL auto_increment, + id int(6) NOT NULL auto_increment, description varchar(40) NOT NULL, idform varchar(40), ordre int(6) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 5bdaad7ffac..4132b1f48a4 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -96,7 +96,7 @@ drop table t1; # CREATE TABLE t1 ( - t1_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t1_id bigint(21) NOT NULL auto_increment, _field_72 varchar(128) DEFAULT '' NOT NULL, _field_95 varchar(32), _field_115 tinyint(4) DEFAULT '0' NOT NULL, @@ -127,7 +127,7 @@ INSERT INTO t2 VALUES (2,1); INSERT INTO t2 VALUES (2,2); CREATE TABLE t3 ( - t3_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t3_id bigint(21) NOT NULL auto_increment, _field_131 varchar(128), _field_133 tinyint(4) DEFAULT '0' NOT NULL, _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, @@ -162,7 +162,7 @@ INSERT INTO t4 VALUES (1,1); INSERT INTO t4 VALUES (2,1); CREATE TABLE t5 ( - t5_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t5_id bigint(21) NOT NULL auto_increment, _field_149 tinyint(4), _field_156 varchar(128) DEFAULT '' NOT NULL, _field_157 varchar(128) DEFAULT '' NOT NULL, @@ -194,7 +194,7 @@ INSERT INTO t6 VALUES (1,2); INSERT INTO t6 VALUES (2,2); CREATE TABLE t7 ( - t7_id bigint(21) DEFAULT '0' NOT NULL auto_increment, + t7_id bigint(21) NOT NULL auto_increment, _field_143 tinyint(4), _field_165 varchar(32), _field_166 smallint(6) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 7f73ec34e3a..7d5d719592c 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -2,7 +2,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( - id int(11) DEFAULT '0' NOT NULL auto_increment, + id int(11) NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL, maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL, diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test index a07a1d97f37..63bbe43512d 100644 --- a/mysql-test/t/type_ranges.test +++ b/mysql-test/t/type_ranges.test @@ -5,7 +5,7 @@ drop table if exists t1,t2,t3; CREATE TABLE t1 ( - auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment, + auto int(5) unsigned NOT NULL auto_increment, string char(10) default "hello", tiny tinyint(4) DEFAULT '0' NOT NULL , short smallint(6) DEFAULT '1' NOT NULL , @@ -91,7 +91,7 @@ select auto,new_field,new_blob_col,date_field from t1 ; # check with old syntax # CREATE TABLE t2 ( - auto int(5) unsigned NOT NULL DEFAULT 0 auto_increment, + auto int(5) unsigned NOT NULL auto_increment, string char(20), mediumblob_col mediumblob not null, new_field char(2), diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 5cbbd2a350e..76a27b62206 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -72,7 +72,7 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); -alter table t1 change lfdnr lfdnr int(10) unsigned default 0 not null auto_increment; +alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment; update t1 set status=1 where type='Open'; select status from t1; drop table t1; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index f1e37889d5f..bff8bc7e3f4 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1373,8 +1373,10 @@ String *Item_func_database::val_str(String *str) String *Item_func_user::val_str(String *str) { + // TODO: make USER() replicate properly (currently it is replicated to "") THD *thd=current_thd; - if (str->copy((const char*) thd->user,(uint) strlen(thd->user)) || + if (!(thd->user) || // for system threads (e.g. replication SQL thread) + str->copy((const char*) thd->user,(uint) strlen(thd->user)) || str->append('@') || str->append(thd->host ? thd->host : thd->ip ? thd->ip : "")) return &empty_string; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8439db0be6b..ad7ccaf8f38 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2880,21 +2880,35 @@ bool add_field_to_list(char *field_name, enum_field_types type, lex->col_list.empty(); } - if (default_value && default_value->type() == Item::NULL_ITEM) + if (default_value) { - if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == - NOT_NULL_FLAG) + if (default_value->type() == Item::NULL_ITEM) { - net_printf(&thd->net,ER_INVALID_DEFAULT,field_name); + default_value=0; + if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) == + NOT_NULL_FLAG) + { + net_printf(&thd->net,ER_INVALID_DEFAULT,field_name); + DBUG_RETURN(1); + } + } +#ifdef MYSQL41000 + else if (type_modifier & AUTO_INCREMENT_FLAG) + { + net_printf(&thd->net, ER_INVALID_DEFAULT, field_name); DBUG_RETURN(1); } - default_value=0; +#endif } if (!(new_field=new create_field())) DBUG_RETURN(1); new_field->field=0; new_field->field_name=field_name; +#ifdef MYSQL41000 + new_field->def= default_value; +#else new_field->def= (type_modifier & AUTO_INCREMENT_FLAG ? 0 : default_value); +#endif new_field->flags= type_modifier; new_field->unireg_check= (type_modifier & AUTO_INCREMENT_FLAG ? Field::NEXT_NUMBER : Field::NONE); diff --git a/support-files/MacOSX/ReadMe.txt b/support-files/MacOSX/ReadMe.txt index ed2d2b4c714..a18c5f3aa41 100644 --- a/support-files/MacOSX/ReadMe.txt +++ b/support-files/MacOSX/ReadMe.txt @@ -46,8 +46,8 @@ the following commands in a terminal window: sudo ./bin/mysqld_safe (Enter your password) (Press CTRL+Z) - (Press CTRL+D to exit the shell) bg + (Press CTRL+D to exit the shell) You should now be able to connect to the MySQL server, e.g. by running /usr/local/mysql/bin/mysql |