From 85d6d3d8ec6c49b1770ad6ca9cb5fc5b82e21aa3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 09:52:19 +0200 Subject: [PATCH 1/7] Comment column in SHOW TABLE STATUS now reports that it can contain NULL values (which is the case for a crashed .frm file). --- sql/sql_show.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 729e1557cdc..15693035a82 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -293,6 +293,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) field_list.push_back(item=new Item_empty_string("Create_options",255)); item->maybe_null=1; field_list.push_back(item=new Item_empty_string("Comment",80)); + item->maybe_null=1; if (send_fields(thd,field_list,1)) DBUG_RETURN(1); From 23a850e5a641f8b124e700916911e22d2cdd06de Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 10:16:50 +0200 Subject: [PATCH 2/7] Fix for SHOW TABLE STATUS with empty .frm file --- sql/sql_show.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 15693035a82..585c30110b3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -312,7 +312,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) casedn_str(file_name); if (!(table = open_ltable(thd, &table_list, TL_READ))) { - for (uint i=0 ; i < field_list.elements ; i++) + for (uint i=2 ; i < field_list.elements ; i++) net_store_null(packet); net_store_data(packet,thd->net.last_error); thd->net.last_error[0]=0; From 8300158d768b4b25633c707137b2713d4433e973 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 15:28:28 +0200 Subject: [PATCH 3/7] A fix for a crashing bug with unspecified database in this type of command: load data infile 'filename' into table db.table; --- sql/sql_load.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index ba62b1d5c20..c4ea41cbb69 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -90,6 +90,13 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, bool is_fifo=0; LOAD_FILE_INFO lf_info; char * db = table_list->db ? table_list->db : thd->db; + char * tdb= thd->db ? thd->db : db; +/* + 'tdb' can be NULL only if both table_list->db and thd->db are NULL + 'db' itself can be NULL. but in that case it will generate + an error earlier open_ltable()). +*/ + bool transactional_table, log_delayed; DBUG_ENTER("mysql_load"); @@ -168,10 +175,10 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, ex->file_name+=dirname_length(ex->file_name); #endif if (!dirname_length(ex->file_name) && - strlen(ex->file_name)+strlen(mysql_data_home)+strlen(thd->db)+3 < + strlen(ex->file_name)+strlen(mysql_data_home)+strlen(tdb)+3 < FN_REFLEN) { - (void) sprintf(name,"%s/%s/%s",mysql_data_home,thd->db,ex->file_name); + (void) sprintf(name,"%s/%s/%s",mysql_data_home,tdb,ex->file_name); unpack_filename(name,name); /* Convert to system format */ } else From 7edb0687c70759e81943883dc279776c8b8145fb Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 19:31:05 +0200 Subject: [PATCH 4/7] ha_innodb.cc: Add docs to store_lock() sql/ha_innodb.cc: Add docs to store_lock() --- sql/ha_innodb.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index b1f1911858d..5c73d36d9bc 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -4143,9 +4143,12 @@ static void free_share(INNOBASE_SHARE *share) /********************************************************************* Converts a MySQL table lock stored in the 'lock' field of the handle to -a proper type before storing the lock. MySQL also calls this when it -releases a lock. */ - +a proper type before storing pointer to the lock into an array of pointers. +MySQL also calls this if it wants to reset some table locks to a not-locked +state during the processing of an SQL query. An example is that during a +SELECT the read lock is released early on the 'const' tables where we only +fetch one row. MySQL does not call this when it releases all locks at the +end of an SQL statement. */ THR_LOCK_DATA** ha_innobase::store_lock( From bdc655d9690e9bcc071251ab4a19dd7ac40ac15c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Feb 2003 19:52:31 +0200 Subject: [PATCH 5/7] ha_innodb.cc: Remove DEBUG_ASSERT if MySQL internally names a UNIQUE index as the PRIMARY KEY, but inside InnoDB there is no primary key for the table sql/ha_innodb.cc: Remove DEBUG_ASSERT if MySQL internally names a UNIQUE index as the PRIMARY KEY, but inside InnoDB there is no primary key for the table --- sql/ha_innodb.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 5c73d36d9bc..b5962526d9e 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1263,7 +1263,13 @@ ha_innobase::open( The column is the row id in the automatical generation case, and it will never be updated anyway. */ - DBUG_ASSERT(key_used_on_scan == MAX_KEY); + + if (key_used_on_scan != MAX_KEY) { + fprintf(stderr, +"InnoDB: Warning: table %s key_used_on_scan is %lu even though there is no\n" +"InnoDB: primary key inside InnoDB.\n", + name, (ulint)key_used_on_scan); + } } auto_inc_counter_for_this_stat = 0; From 66afa065530f724702b82e51c3c88a8770330230 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Feb 2003 00:06:09 +0200 Subject: [PATCH 6/7] Code cleanup --- sql/sql_load.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sql/sql_load.cc b/sql/sql_load.cc index c4ea41cbb69..62ed0fc5bed 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -89,14 +89,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, *enclosed=ex->enclosed; bool is_fifo=0; LOAD_FILE_INFO lf_info; - char * db = table_list->db ? table_list->db : thd->db; - char * tdb= thd->db ? thd->db : db; -/* - 'tdb' can be NULL only if both table_list->db and thd->db are NULL - 'db' itself can be NULL. but in that case it will generate - an error earlier open_ltable()). -*/ - + char *db = table_list->db; // This is never null + /* If no current database, use database where table is located */ + char *tdb= thd->db ? thd->db : db; bool transactional_table, log_delayed; DBUG_ENTER("mysql_load"); From 3f9ea80268126f8401bd27f03b842cd03cde7c9f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Feb 2003 02:10:19 +0200 Subject: [PATCH 7/7] Integer values between 9223372036854775807 and 9999999999999999999 are now regarded as unsigned longlongss, not as floats. This make these values work similar to values between 10000000000000000000 and 18446744073709551615. mysql-test/r/bigint.result: Fixed results for bigints mysql-test/t/bigint.test: Fixed results for bigints sql/item.h: Mark unsigned big ints as unsigned sql/sql_lex.cc: Returns numbers between 9223372036854775807 and 9999999999999999999 as unsigned 64 bit numbers --- mysql-test/r/bigint.result | 4 ++-- mysql-test/t/bigint.test | 6 ------ sql/item.h | 5 +++++ sql/sql_lex.cc | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 40d29e17237..d7d811dc5f3 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -6,13 +6,13 @@ select 9223372036854775807,-009223372036854775808; 9223372036854775807 -9223372036854775808 select +9999999999999999999,-9999999999999999999; +9999999999999999999 -9999999999999999999 -10000000000000000000 -10000000000000000000 +9999999999999999999 -10000000000000000000 select cast(9223372036854775808 as unsigned)+1; cast(9223372036854775808 as unsigned)+1 9223372036854775809 select 9223372036854775808+1; 9223372036854775808+1 -9223372036854775808 +9223372036854775809 drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 287d157e5d6..c5691a760c7 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -5,12 +5,6 @@ select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; select 9223372036854775807,-009223372036854775808; select +9999999999999999999,-9999999999999999999; select cast(9223372036854775808 as unsigned)+1; - -# -# We need to do a REPLACE here as the atof() function returns different -# values on True64 and HPUX11 -# ---replace_result 9223372036854775800 9223372036854775808 select 9223372036854775808+1; # # In 3.23 we have to disable the test of column to bigint as diff --git a/sql/item.h b/sql/item.h index c669c266f0f..a72079a6856 100644 --- a/sql/item.h +++ b/sql/item.h @@ -212,6 +212,11 @@ public: String *val_str(String*); void make_field(Send_field *field); Item *new_item() { return new Item_uint(name,max_length); } + bool fix_fields(THD *thd,struct st_table_list *table_list) + { + unsigned_flag= 1; + return 0; + } void print(String *str); unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 854f3924155..d5a225d95dd 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -407,7 +407,7 @@ inline static uint int_token(const char *str,uint length) { cmp=longlong_str; smaller=LONG_NUM; - bigger=REAL_NUM; + bigger= ULONGLONG_NUM; } } while (*cmp && *cmp++ == *str++) ;