From 1392f4820aba16e2349a46962d8b7c7cddadd800 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 15:48:56 +0500 Subject: BUG#7709 fix - Boolean fulltext query against unsupported engines does not fail. mysql-test/r/innodb.result: Test case for BUG#7709 - Boolean fulltext query against unsupported engines does not fail added. mysql-test/t/innodb.test: Test case for BUG#7709 - Boolean fulltext query against unsupported engines does not fail added. sql/item_func.cc: Check if table supports fulltext. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/innodb.result | 3 +++ mysql-test/t/innodb.test | 9 +++++++++ sql/item_func.cc | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5a34dbbb1d8..7052d853b00 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -142,6 +142,7 @@ serg@sergbook.mylan serg@sergbook.mysql.com sergefp@mysql.com sinisa@rhols221.adsl.netsonic.fi +svoj@mysql.com tfr@beta.frontier86.ee tfr@indrek.tfr.cafe.ee tfr@sarvik.tfr.cafe.ee diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index f00679801f8..dbfe1c3aff5 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1272,3 +1272,6 @@ Cannot delete or update a parent row: a foreign key constraint fails delete from t1 where id=15; delete from t1 where id=0; drop table t1; +CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; +SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); +The used table type doesn't support FULLTEXT indexes diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 2c8002ea841..c25f295cac8 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -911,3 +911,12 @@ delete from t1 where id=15; delete from t1 where id=0; drop table t1; + +# +# BUG#7709 test case - Boolean fulltext query against unsupported +# engines does not fail +# + +CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; +--error 1214; +SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); diff --git a/sql/item_func.cc b/sql/item_func.cc index 334be48dc9a..855e86b2382 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2257,6 +2257,11 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) key=NO_SUCH_KEY; const_item_cache=0; table=((Item_field *)fields.head())->field->table; + if (!(table->file->table_flags() & HA_CAN_FULLTEXT)) + { + my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0)); + return 1; + } table->fulltext_searched=1; record=table->record[0]; if (key == NO_SUCH_KEY && mode != FT_BOOL) -- cgit v1.2.1 From 6e13083d658faccd5aee83f32d1e0d9c45c87ebd Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 15:11:31 +0200 Subject: errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/czech/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/danish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/dutch/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/english/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/estonian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/french/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/german/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/greek/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/hungarian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/italian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/japanese/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/korean/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/norwegian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/norwegian-ny/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/polish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/portuguese/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/romanian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/russian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/slovak/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/spanish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/swedish/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). sql/share/ukrainian/errmsg.txt: Add newline at EOF for proper processing by comp-err.exe on Windows where fgets() works differently than Linux (Bug #6195). BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/share/czech/errmsg.txt | 1 + sql/share/danish/errmsg.txt | 1 + sql/share/dutch/errmsg.txt | 1 + sql/share/english/errmsg.txt | 1 + sql/share/estonian/errmsg.txt | 1 + sql/share/french/errmsg.txt | 1 + sql/share/german/errmsg.txt | 1 + sql/share/greek/errmsg.txt | 1 + sql/share/hungarian/errmsg.txt | 1 + sql/share/italian/errmsg.txt | 1 + sql/share/japanese/errmsg.txt | 1 + sql/share/korean/errmsg.txt | 1 + sql/share/norwegian-ny/errmsg.txt | 1 + sql/share/norwegian/errmsg.txt | 1 + sql/share/polish/errmsg.txt | 1 + sql/share/portuguese/errmsg.txt | 1 + sql/share/romanian/errmsg.txt | 1 + sql/share/russian/errmsg.txt | 1 + sql/share/slovak/errmsg.txt | 1 + sql/share/spanish/errmsg.txt | 1 + sql/share/swedish/errmsg.txt | 1 + sql/share/ukrainian/errmsg.txt | 1 + 23 files changed, 23 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 967f8c7cb47..998f8234343 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -107,6 +107,7 @@ monty@work.mysql.com mwagner@cash.mwagner.org mwagner@evoq.mwagner.org mwagner@here.mwagner.org +mwagner@ultrafly.mysql.com mwagner@work.mysql.com mysqldev@build.mysql2.com nick@mysql.com diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 88ecaed386b..70aea3fdf62 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -265,3 +265,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 6210bf7788c..8c0bf688311 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -256,3 +256,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index c3607f4cd0f..c2baf0240af 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -265,3 +265,4 @@ "Kreeg fatale fout %d: '%-.128s' van master tijdens lezen van data uit binaire log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 7c9d789c86e..ed5977fd78c 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -255,3 +255,4 @@ "Variable '%-.64s' is a %s variable" ] # End of error messages # Do NOT add new error messages here as this makes merges to 4.1 too hard! + diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 8157a33836e..581baf24e09 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -258,3 +258,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 3c88ccc0378..9aa430aa718 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -253,3 +253,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 91f3f91a464..7fa896bcc34 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -257,3 +257,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index aff7f8ba3c2..2a2bee5d69a 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -253,3 +253,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 60dc3204bb4..f998116410f 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -258,3 +258,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index c51c69cf298..2ab360dff4e 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -253,3 +253,4 @@ "Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index fb604923e4e..4ad7cc3ec37 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -257,3 +257,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 764cbb78740..3b027796c3b 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -253,3 +253,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 424530ecf87..5b994d2dc5b 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -255,3 +255,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 73314ea647b..305bf10899b 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -255,3 +255,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index f24a54ec8e8..8d6b2fa542e 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -258,3 +258,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 2810ac134b1..6fcc044c6b6 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -255,3 +255,4 @@ "Obteve fatal erro %d: '%-.128s' do master quando lendo dados do binary log", "Slave SQL thread ignorado a consulta devido às normas de replicação-*-tabela" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 552b532c0a2..c218f19e212 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -258,3 +258,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 668b310a5dc..4419da08051 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -258,3 +258,4 @@ "ðÏÌÕÞÅÎÁ ÎÅÉÓÐÒÁ×ÉÍÁÑ ÏÛÉÂËÁ %d: '%-.128s' ÏÔ ÇÏÌÏ×ÎÏÇÏ ÓÅÒ×ÅÒÁ × ÐÒÏÃÅÓÓÅ ×ÙÂÏÒËÉ ÄÁÎÎÙÈ ÉÚ Ä×ÏÉÞÎÏÇÏ ÖÕÒÎÁÌÁ", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 8467fad5b11..bb241673706 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -261,3 +261,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 4ab76a64ca7..2daeebc8eb8 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -256,3 +256,4 @@ "Recibió fatal error %d: '%-.128s' del master cuando leyendo datos del binary log", "Slave SQL thread ignorado el query debido a las reglas de replicación-*-tabla" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 352a226ef23..a9273f6222c 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -253,3 +253,4 @@ "Fick fatalt fel %d: '%-.128s' från master vid läsning av binärloggen" "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 131cf07a8e2..371dd16d737 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -259,3 +259,4 @@ "Got fatal error %d: '%-.128s' from master when reading data from binary log", "Slave SQL thread ignored the query because of replicate-*-table rules" "Variable '%-.64s' is a %s variable" + -- cgit v1.2.1 From f5f132fdde32f1798612c8d5b17a1fecf5f1c0fa Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 21:37:27 +0500 Subject: Test fix. DROP TABLE added. --- mysql-test/r/innodb.result | 1 + mysql-test/t/innodb.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index dbfe1c3aff5..f634edcbe91 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1275,3 +1275,4 @@ drop table t1; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); The used table type doesn't support FULLTEXT indexes +DROP TABLE t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index c25f295cac8..96975d54810 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -920,3 +920,4 @@ drop table t1; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; --error 1214; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); +DROP TABLE t1; -- cgit v1.2.1 From 3e1dad411598662152dd5100c2fb88219a31634f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 21:03:50 +0100 Subject: Bug#6236 Incomplete ALTER TABLE breaks MERGE compatibility Fix implicit NOT NULL not set on ALTER of PK columns mysql-test/r/alter_table.result: Test for Bug#6236 mysql-test/t/alter_table.test: Test for Bug#6236 sql/sql_table.cc: Implicit NOT NULL not set on ALTER of PK columns BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/r/alter_table.result | 20 ++++++++++++++++++++ mysql-test/t/alter_table.test | 13 +++++++++++++ sql/sql_table.cc | 23 +++++++++++++++++------ 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index bf0dfb9e31d..5a34dbbb1d8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net +antony@ltantony.mysql.com antony@ltantony.rdg.cyberkinetica.homeunix.net arjen@bitbike.com arjen@co3064164-a.bitbike.com diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 78925a64e93..80d3ef5e0a5 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -386,3 +386,23 @@ Incorrect table name 't1\\' rename table t1 to `t1\\`; Incorrect table name 't1\\' drop table t1; +drop table if exists t1, t2; +create table t1 ( a varchar(10) not null primary key ) engine=myisam; +create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1); +flush tables; +alter table t1 modify a varchar(10); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(10) NOT NULL default '', + PRIMARY KEY (`a`) +) TYPE=MRG_MyISAM UNION=(t1) +flush tables; +alter table t1 modify a varchar(10) not null; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(10) NOT NULL default '', + PRIMARY KEY (`a`) +) TYPE=MRG_MyISAM UNION=(t1) +drop table if exists t1, t2; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 11290134a71..c69f9aabae6 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -254,3 +254,16 @@ alter table t1 rename to `t1\\`; rename table t1 to `t1\\`; drop table t1; +# +# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns +# +drop table if exists t1, t2; +create table t1 ( a varchar(10) not null primary key ) engine=myisam; +create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1); +flush tables; +alter table t1 modify a varchar(10); +show create table t2; +flush tables; +alter table t1 modify a varchar(10) not null; +show create table t2; +drop table if exists t1, t2; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cef480fadde..e065e5dfc58 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1795,6 +1795,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } KEY_PART_INFO *key_part= key_info->key_part; + enum Key::Keytype key_type= key_info->flags & HA_NOSAME ? + (!my_strcasecmp(key_name, "PRIMARY") ? + Key::PRIMARY : Key::UNIQUE) : + (key_info->flags & HA_FULLTEXT ? + Key::FULLTEXT : Key::MULTIPLE); key_parts.empty(); for (uint j=0 ; j < key_info->key_parts ; j++,key_part++) { @@ -1824,16 +1829,22 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, cfield->pack_length <= key_part_length)) key_part_length=0; // Use whole field } + if (!(cfield->flags & NOT_NULL_FLAG)) + { + if (key_type == Key::PRIMARY) + { + /* Implicitly set primary key fields to NOT NULL for ISO conf. */ + cfield->flags|= NOT_NULL_FLAG; + cfield->pack_flag&= ~FIELDFLAG_MAYBE_NULL; + } + else + key_info->flags|= HA_NULL_PART_KEY; + } key_parts.push_back(new key_part_spec(cfield->field_name, key_part_length)); } if (key_parts.elements) - key_list.push_back(new Key(key_info->flags & HA_NOSAME ? - (!my_strcasecmp(key_name, "PRIMARY") ? - Key::PRIMARY : Key::UNIQUE) : - (key_info->flags & HA_FULLTEXT ? - Key::FULLTEXT : Key::MULTIPLE), - key_name,key_parts)); + key_list.push_back(new Key(key_type,key_name,key_parts)); } key_it.rewind(); { -- cgit v1.2.1 From 3ac2df4e4c2366d4b30b3251590207a3d07f483d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 May 2005 22:56:58 +0100 Subject: Bug#8191 - SELECT INTO OUTFILE insists on FROM clause Fix bug + include test case. Enable outfile tests. mysql-test/t/outfile.test: Reenable outfile tests Add test for Bug#8191 sql/sql_yacc.yy: Fix Bug#8191 BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + mysql-test/include/have_outfile.inc | 5 +++ mysql-test/include/test_outfile.inc | 1 + mysql-test/r/have_outfile.require | 3 ++ mysql-test/r/outfile.result | Bin 0 -> 953 bytes mysql-test/t/outfile.test | 60 +++++++++++++++++++++++++----------- sql/sql_yacc.yy | 7 +++-- 7 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 mysql-test/include/have_outfile.inc create mode 100644 mysql-test/include/test_outfile.inc create mode 100644 mysql-test/r/have_outfile.require create mode 100644 mysql-test/r/outfile.result diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index bf0dfb9e31d..5a34dbbb1d8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -9,6 +9,7 @@ acurtis@pcgem.rdg.cyberkinetica.com ahlentz@co3064164-a.rochd1.qld.optusnet.com.au akishkin@work.mysql.com antony@ltantony.dsl-verizon.net +antony@ltantony.mysql.com antony@ltantony.rdg.cyberkinetica.homeunix.net arjen@bitbike.com arjen@co3064164-a.bitbike.com diff --git a/mysql-test/include/have_outfile.inc b/mysql-test/include/have_outfile.inc new file mode 100644 index 00000000000..31e95f4810a --- /dev/null +++ b/mysql-test/include/have_outfile.inc @@ -0,0 +1,5 @@ +-- require r/have_outfile.require +disable_query_log; +select load_file(concat(@tmpdir,"/outfile.test")); +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile.test +enable_query_log; diff --git a/mysql-test/include/test_outfile.inc b/mysql-test/include/test_outfile.inc new file mode 100644 index 00000000000..0bede4938c6 --- /dev/null +++ b/mysql-test/include/test_outfile.inc @@ -0,0 +1 @@ +eval select "Outfile OK" into outfile "$MYSQL_TEST_DIR/var/tmp/outfile.test"; diff --git a/mysql-test/r/have_outfile.require b/mysql-test/r/have_outfile.require new file mode 100644 index 00000000000..9fc2f8fdb5a --- /dev/null +++ b/mysql-test/r/have_outfile.require @@ -0,0 +1,3 @@ +load_file(concat(@tmpdir,"/outfile.test")) +Outfile OK + diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result new file mode 100644 index 00000000000..a2720be075a Binary files /dev/null and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index c126d221bd2..f86c4163289 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -1,23 +1,47 @@ +disable_query_log; +-- source include/test_outfile.inc +eval set @tmpdir="$MYSQL_TEST_DIR/var/tmp"; +enable_query_log; +-- source include/have_outfile.inc # # test of into outfile|dumpfile # -# We need to check that we have 'file' privilege. +drop table if exists t1; +create table t1 (`a` blob); +insert into t1 values("hello world"),("Hello mars"),(NULL); +disable_query_log; +eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1; +enable_query_log; +select load_file(concat(@tmpdir,"/outfile-test.1")); +disable_query_log; +eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1 limit 1; +enable_query_log; +select load_file(concat(@tmpdir,"/outfile-test.2")); +disable_query_log; +eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1 where a is null; +enable_query_log; +select load_file(concat(@tmpdir,"/outfile-test.3")); -#drop table if exists t1; -#create table t1 (`a` blob); -#insert into t1 values("hello world"),("Hello mars"),(NULL); -#select * into outfile "/tmp/select-test.1" from t1; -#select load_file("/tmp/select-test.1"); -#select * into dumpfile "/tmp/select-test.2" from t1 limit 1; -#select load_file("/tmp/select-test.2"); -#select * into dumpfile "/tmp/select-test.3" from t1 where a is null; -#select load_file("/tmp/select-test.3"); -# -## the following should give errors -# -#select * into outfile "/tmp/select-test.1" from t1; -#select * into dumpfile "/tmp/select-test.1" from t1; -#select * into dumpfile "/tmp/select-test.99" from t1; -#select load_file("/tmp/select-test.not-exist"); -#drop table t1; +# the following should give errors + +disable_query_log; +--error 1086 +eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1; +--error 1086 +eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1; +--error 1086 +eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1; +enable_query_log; +select load_file(concat(@tmpdir,"/outfile-test.not-exist")); +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1 +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2 +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3 +drop table t1; + +# Bug#8191 +disable_query_log; +eval select 1 into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.4"; +enable_query_log; +select load_file(concat(@tmpdir,"/outfile-test.4")); +--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4 diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8c5c4d61d1d..68d08b353d9 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1537,9 +1537,10 @@ select_part2: select_into: limit_clause {} + | into | select_from - | opt_into select_from - | select_from opt_into; + | into select_from + | select_from into; select_from: FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause; @@ -2507,7 +2508,7 @@ procedure_item: $2->set_name($1,(uint) ((char*) lex->tok_end - $1)); }; -opt_into: +into: INTO OUTFILE TEXT_STRING { THD *thd= current_thd; -- cgit v1.2.1 From adefe15c9f623bd4dab7ed99ec1dc6ff9a24bb61 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 May 2005 08:33:45 +0100 Subject: Fix outfile test/results --- mysql-test/r/outfile.result | Bin 953 -> 683 bytes mysql-test/t/outfile.test | 17 +++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result index a2720be075a..a7871592241 100644 Binary files a/mysql-test/r/outfile.result and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index f86c4163289..800c9f4fd3f 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -25,14 +25,15 @@ select load_file(concat(@tmpdir,"/outfile-test.3")); # the following should give errors -disable_query_log; ---error 1086 -eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1; ---error 1086 -eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1; ---error 1086 -eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1; -enable_query_log; +#disabled as error message has variable path +#disable_query_log; +#--error 1086 +#eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1; +#--error 1086 +#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1; +#--error 1086 +#eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1; +#enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1 --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2 -- cgit v1.2.1 From 913e2e12d2fa2095989b5ddbfc0fc97751da0cbf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 May 2005 12:14:46 -0500 Subject: mysqldump.1.in: Remove obsolete section number. (Bug #10534) man/mysqldump.1.in: Remove obsolete section number. (Bug #10534) --- man/mysqldump.1.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/man/mysqldump.1.in b/man/mysqldump.1.in index 4d841117e59..0f581429af7 100644 --- a/man/mysqldump.1.in +++ b/man/mysqldump.1.in @@ -218,7 +218,8 @@ or ), mysqldump will create rows up to net_buffer_length length. If you increase this variable, you should also ensure that the max_allowed_packet variable in the MySQL server is bigger than the net_buffer_length. .SH EXAMPLES .TP -The most normal use of mysqldump is probably for making a backup of whole databases. See Mysql Manual section 21.2 Database Backups. +The most normal use of mysqldump is probably for making a backup of whole +databases. See the section on Database Backups in the MySQL Reference Manual. .TP mysqldump \-\-opt \fP\fIdatabase\fP > backup-file.sql .TP -- cgit v1.2.1 From 7c441dd1157c8ad525babb3fbbd43daff86a50ec Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 11:11:50 +0300 Subject: Change create_field->offset to store offset from start of fields, independent of null bits. Count null_bits separately from field offsets and adjust them in case of primary key parts. (Previously a CREATE TABLE with a lot of null fields that was part of a primary key caused MySQL to wrongly count the number of bytes needed to store null bits) This is a more complete bug fix for #6236 mysql-test/r/alter_table.result: More test for bug #6236 (CREATE TABLE didn't properly count not null columns for primary keys) mysql-test/t/alter_table.test: More test for bug #6236 (CREATE TABLE didn't properly count not null columns for primary keys) sql/handler.h: Add counter for null fields sql/sql_table.cc: Change create_field->offset to store offset from start of fields, independent of null bits. Count null_bits separately from field offsets and adjust them in case of primary key parts. sql/unireg.cc: Change create_field->offset to store offset from start of fields, independent of null bits. Count null_bits separately from field offsets and adjust them in case of primary key parts. --- mysql-test/r/alter_table.result | 16 ++++++++ mysql-test/t/alter_table.test | 17 +++++++++ sql/handler.h | 1 + sql/sql_table.cc | 37 +++++++----------- sql/unireg.cc | 83 +++++++++++++++++++++++++---------------- 5 files changed, 98 insertions(+), 56 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 80d3ef5e0a5..19d2ca4d6ed 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -406,3 +406,19 @@ t2 CREATE TABLE `t2` ( PRIMARY KEY (`a`) ) TYPE=MRG_MyISAM UNION=(t1) drop table if exists t1, t2; +create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +show table status like 't1'; +Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment +t1 MyISAM Fixed 1 37 37 X X X X X X X X +alter table t1 modify a int; +show table status like 't1'; +Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment +t1 MyISAM Fixed 1 37 37 X X X X X X X X +drop table t1; +create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +show table status like 't1'; +Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment +t1 MyISAM Fixed 1 37 37 X X X X X X X X +drop table t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index c69f9aabae6..af0ec2bca16 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -267,3 +267,20 @@ flush tables; alter table t1 modify a varchar(10) not null; show create table t2; drop table if exists t1, t2; + +# The following is also part of bug #6236 (CREATE TABLE didn't properly count +# not null columns for primary keys) + +create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status like 't1'; +alter table t1 modify a int; +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status like 't1'; +drop table t1; +create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X +show table status like 't1'; +drop table t1; diff --git a/sql/handler.h b/sql/handler.h index ac00050b777..e52164a871a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -164,6 +164,7 @@ typedef struct st_ha_create_information SQL_LIST merge_list; enum db_type db_type; enum row_type row_type; + uint null_bits; /* NULL bits at start of record */ uint options; /* OR of HA_CREATE_ options */ uint raid_type,raid_chunks; uint merge_insert_method; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e065e5dfc58..e275f902abd 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -363,7 +363,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, create_field *sql_field,*dup_field; int error= -1; uint db_options,field,null_fields,blob_columns; - ulong pos; + ulong record_offset; KEY *key_info,*key_info_buffer; KEY_PART_INFO *key_part_info; int auto_increment=0; @@ -418,10 +418,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, } it2.rewind(); } - /* If fixed row records, we need one bit to check for deleted rows */ - if (!(db_options & HA_OPTION_PACK_RECORD)) - null_fields++; - pos=(null_fields+7)/8; + + /* record_offset will be increased with 'length-of-null-bits' later */ + record_offset= 0; it.rewind(); while ((sql_field=it++)) @@ -478,10 +477,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, } if (!(sql_field->flags & NOT_NULL_FLAG)) sql_field->pack_flag|=FIELDFLAG_MAYBE_NULL; - sql_field->offset= pos; + sql_field->offset= record_offset; if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) auto_increment++; - pos+=sql_field->pack_length; + record_offset+= sql_field->pack_length; } if (auto_increment > 1) { @@ -578,11 +577,12 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, column->field_name); DBUG_RETURN(-1); } - /* for fulltext keys keyseg length is 1 for blobs (it's ignored in - ft code anyway, and 0 (set to column width later) for char's. - it has to be correct col width for char's, as char data are not - prefixed with length (unlike blobs, where ft code takes data length - from a data prefix, ignoring column->length). + /* + for fulltext keys keyseg length is 1 for blobs (it's ignored in + ft code anyway, and 0 (set to column width later) for char's. + it has to be correct col width for char's, as char data are not + prefixed with length (unlike blobs, where ft code takes data length + from a data prefix, ignoring column->length). */ if (key->type == Key::FULLTEXT) column->length=test(f_is_blob(sql_field->pack_flag)); @@ -609,6 +609,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, /* Implicitly set primary key fields to NOT NULL for ISO conf. */ sql_field->flags|= NOT_NULL_FLAG; sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL; + null_fields--; } else key_info->flags|= HA_NULL_PART_KEY; @@ -765,6 +766,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (thd->sql_mode & MODE_NO_DIR_IN_CREATE) create_info->data_file_name= create_info->index_file_name= 0; create_info->table_options=db_options; + create_info->null_bits= null_fields; if (rea_create_table(path, create_info, fields, key_count, key_info_buffer)) @@ -1829,17 +1831,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, cfield->pack_length <= key_part_length)) key_part_length=0; // Use whole field } - if (!(cfield->flags & NOT_NULL_FLAG)) - { - if (key_type == Key::PRIMARY) - { - /* Implicitly set primary key fields to NOT NULL for ISO conf. */ - cfield->flags|= NOT_NULL_FLAG; - cfield->pack_flag&= ~FIELDFLAG_MAYBE_NULL; - } - else - key_info->flags|= HA_NULL_PART_KEY; - } key_parts.push_back(new key_part_spec(cfield->field_name, key_part_length)); } diff --git a/sql/unireg.cc b/sql/unireg.cc index 218ea6b5b8d..f81370539c6 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -32,18 +32,21 @@ static uchar * pack_screens(List &create_fields, uint *info_length, uint *screens, bool small_file); -static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info); +static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info, + ulong data_offset); static bool pack_header(uchar *forminfo, enum db_type table_type, List &create_fields, uint info_length, uint screens, uint table_options, - handler *file); + ulong data_offset, handler *file); static uint get_interval_id(uint *int_count,List &create_fields, create_field *last_field); -static bool pack_fields(File file, List &create_fields); +static bool pack_fields(File file, List &create_fields, + ulong data_offset); static bool make_empty_rec(int file, enum db_type table_type, uint table_options, List &create_fields, - uint reclength,uint null_fields); + uint reclength, uint null_fields, + ulong data_offset); int rea_create_table(my_string file_name, @@ -53,7 +56,7 @@ int rea_create_table(my_string file_name, { uint reclength,info_length,screens,key_info_length,maxlength,null_fields; File file; - ulong filepos; + ulong filepos, data_offset; uchar fileinfo[64],forminfo[288],*keybuff; TYPELIB formnames; uchar *screen_buff; @@ -64,8 +67,15 @@ int rea_create_table(my_string file_name, if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0))) DBUG_RETURN(1); db_file=get_new_handler((TABLE*) 0, create_info->db_type); + + /* If fixed row records, we need one bit to check for deleted rows */ + if (!(create_info->table_options & HA_OPTION_PACK_RECORD)) + create_info->null_bits++; + data_offset= (create_info->null_bits + 7) / 8; + if (pack_header(forminfo, create_info->db_type,create_fields,info_length, - screens, create_info->table_options, db_file)) + screens, create_info->table_options, + data_offset, db_file)) { NET *net=my_pthread_getspecific_ptr(NET*,THR_NET); my_free((gptr) screen_buff,MYF(0)); @@ -77,7 +87,7 @@ int rea_create_table(my_string file_name, if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,1))) DBUG_RETURN(1); if (pack_header(forminfo, create_info->db_type, create_fields,info_length, - screens, create_info->table_options, db_file)) + screens, create_info->table_options, data_offset, db_file)) { my_free((gptr) screen_buff,MYF(0)); DBUG_RETURN(1); @@ -95,7 +105,7 @@ int rea_create_table(my_string file_name, uint key_buff_length=uint2korr(fileinfo+14); keybuff=(uchar*) my_alloca(key_buff_length); - key_info_length=pack_keys(keybuff,keys,key_info); + key_info_length= pack_keys(keybuff, keys, key_info, data_offset); VOID(get_form_pos(file,fileinfo,&formnames)); if (!(filepos=make_new_entry(file,fileinfo,&formnames,""))) goto err; @@ -117,13 +127,13 @@ int rea_create_table(my_string file_name, (ulong) uint2korr(fileinfo+6)+ (ulong) key_buff_length, MY_SEEK_SET,MYF(0))); if (make_empty_rec(file,create_info->db_type,create_info->table_options, - create_fields,reclength,null_fields)) + create_fields,reclength, null_fields, data_offset)) goto err; VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); if (my_write(file,(byte*) forminfo,288,MYF_RW) || my_write(file,(byte*) screen_buff,info_length,MYF_RW) || - pack_fields(file,create_fields)) + pack_fields(file, create_fields, data_offset)) goto err; #ifdef HAVE_CRYPTED_FRM @@ -248,7 +258,8 @@ static uchar * pack_screens(List &create_fields, /* Pack keyinfo and keynames to keybuff for save in form-file. */ -static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo) +static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, + ulong data_offset) { uint key_parts,length; uchar *pos, *keyname_pos, *key_alg_pos; @@ -273,10 +284,13 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo) key_part++) { - DBUG_PRINT("loop",("field: %d startpos: %ld length: %ld", - key_part->fieldnr,key_part->offset,key_part->length)); + uint offset; + DBUG_PRINT("loop",("field: %d startpos: %lu length: %ld", + key_part->fieldnr, key_part->offset + data_offset, + key_part->length)); int2store(pos,key_part->fieldnr+1+FIELD_NAME_USED); - int2store(pos+2,key_part->offset+1); + offset= (uint) (key_part->offset+data_offset+1); + int2store(pos+2, offset); pos[4]=0; // Sort order int2store(pos+5,key_part->key_type); int2store(pos+7,key_part->length); @@ -316,8 +330,8 @@ static uint pack_keys(uchar *keybuff,uint key_count,KEY *keyinfo) static bool pack_header(uchar *forminfo, enum db_type table_type, List &create_fields, - uint info_length, uint screens,uint table_options, - handler *file) + uint info_length, uint screens, uint table_options, + ulong data_offset, handler *file) { uint length,int_count,int_length,no_empty, int_parts, time_stamp_pos,null_fields; @@ -351,10 +365,10 @@ static bool pack_header(uchar *forminfo, enum db_type table_type, if ((MTYP_TYPENR(field->unireg_check) == Field::TIMESTAMP_FIELD || f_packtype(field->pack_flag) == (int) FIELD_TYPE_TIMESTAMP) && !time_stamp_pos) - time_stamp_pos=(int) field->offset+1; + time_stamp_pos= (uint) field->offset+ (uint) data_offset + 1; length=field->pack_length; - if ((int) field->offset+length > reclength) - reclength=(int) field->offset+length; + if ((uint) field->offset+ (uint) data_offset+ length > reclength) + reclength=(uint) (field->offset+ data_offset + length); n_length+= (ulong) strlen(field->field_name)+1; field->interval_id=0; if (field->interval) @@ -440,7 +454,8 @@ static uint get_interval_id(uint *int_count,List &create_fields, /* Save fields, fieldnames and intervals */ -static bool pack_fields(File file,List &create_fields) +static bool pack_fields(File file, List &create_fields, + ulong data_offset) { reg2 uint i; uint int_count; @@ -455,11 +470,13 @@ static bool pack_fields(File file,List &create_fields) int_count=0; while ((field=it++)) { + uint recpos; buff[0]= (uchar) field->row; buff[1]= (uchar) field->col; buff[2]= (uchar) field->sc_length; buff[3]= (uchar) field->length; - uint recpos=(uint) field->offset+1; + /* The +1 is here becasue the col offset in .frm file have offset 1 */ + recpos= field->offset+1 + (uint) data_offset; int2store(buff+4,recpos); int2store(buff+6,field->pack_flag); int2store(buff+8,field->unireg_check); @@ -519,11 +536,12 @@ static bool pack_fields(File file,List &create_fields) static bool make_empty_rec(File file,enum db_type table_type, uint table_options, List &create_fields, - uint reclength, uint null_fields) + uint reclength, uint null_fields, + ulong data_offset) { int error; Field::utype type; - uint firstpos,null_count,null_length; + uint firstpos,null_count; uchar *buff,*null_pos; TABLE table; create_field *field; @@ -547,17 +565,16 @@ static bool make_empty_rec(File file,enum db_type table_type, firstpos=reclength; null_count=0; if (!(table_options & HA_OPTION_PACK_RECORD)) - { - null_fields++; // Need one bit for delete mark - null_count++; - } - bfill(buff,(null_length=(null_fields+7)/8),255); + null_count++; // Need one bit for delete mark + DBUG_ASSERT(data_offset == ((null_fields + null_count + 7) / 8)); + bfill(buff, (uint) data_offset, 255); null_pos=buff; List_iterator it(create_fields); while ((field=it++)) { - Field *regfield=make_field((char*) buff+field->offset,field->length, + Field *regfield=make_field((char*) buff+field->offset + data_offset, + field->length, field->flags & NOT_NULL_FLAG ? 0: null_pos+null_count/8, 1 << (null_count & 7), @@ -570,9 +587,9 @@ static bool make_empty_rec(File file,enum db_type table_type, if (!(field->flags & NOT_NULL_FLAG)) null_count++; - if ((uint) field->offset < firstpos && + if ((uint) (field->offset + data_offset) < firstpos && regfield->type() != FIELD_TYPE_NULL) - firstpos= field->offset; + firstpos= field->offset + data_offset; type= (Field::utype) MTYP_TYPENR(field->unireg_check); @@ -596,8 +613,8 @@ static bool make_empty_rec(File file,enum db_type table_type, } /* Fill not used startpos */ - bfill((byte*) buff+null_length,firstpos-null_length,255); - error=(int) my_write(file,(byte*) buff,(uint) reclength,MYF_RW); + bfill((byte*) buff+data_offset, firstpos- (uint) data_offset, 255); + error=(int) my_write(file,(byte*) buff, (uint) reclength,MYF_RW); my_free((gptr) buff,MYF(MY_FAE)); delete handler; DBUG_RETURN(error); -- cgit v1.2.1 From 2a695127a65a321b98f0db6f1b113af3403376e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 14:04:32 +0300 Subject: Fixes during review mysql-test/r/select.result: Better error message mysql-test/t/select.test: Better error message sql/hostname.cc: Join identical code sql/sql_yacc.yy: Combine code (and get a better error message) strings/ctype-ucs2.c: Cast pointer differencess --- mysql-test/r/select.result | 4 ++-- mysql-test/t/select.test | 4 ++-- sql/hostname.cc | 4 ++-- sql/sql_yacc.yy | 29 ++++++++++------------------- strings/ctype-ucs2.c | 8 +++++--- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 50300ed9b76..387e7eff693 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2451,7 +2451,7 @@ a select distinct distinct * from t1; a select all distinct * from t1; -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 'distinct * from t1' at line 1 +ERROR HY000: Incorrect usage of ALL and DISTINCT select distinct all * from t1; -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 'all * from t1' at line 1 +ERROR HY000: Incorrect usage of ALL and DISTINCT drop table t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 6d6d5f6b6e1..a46522c1510 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1987,9 +1987,9 @@ drop table t1; create table t1 (a int(11)); select all all * from t1; select distinct distinct * from t1; ---error 1064 +--error 1221 select all distinct * from t1; ---error 1064 +--error 1221 select distinct all * from t1; drop table t1; diff --git a/sql/hostname.cc b/sql/hostname.cc index ec5c6f29a27..39223556024 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -209,8 +209,8 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors) DBUG_PRINT("error",("gethostbyaddr returned %d",errno)); if (errno == HOST_NOT_FOUND || errno == NO_DATA) - add_wrong_ip(in); /* only cache negative responses, not failures */ - + goto add_wrong_ip_and_return; + /* Failure, don't cache responce */ DBUG_RETURN(0); } if (!hp->h_name[0]) // Don't allow empty hostnames diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index abe7a716a69..28d3560e5f0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2467,7 +2467,14 @@ select_from: select_options: /* empty*/ - | select_option_list; + | select_option_list + { + if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT)) + { + net_printf(Lex->thd, ER_WRONG_USAGE, "ALL", "DISTINCT"); + YYABORT; + } + } select_option_list: select_option_list select_option @@ -2481,15 +2488,7 @@ select_option: YYABORT; Lex->lock_option= TL_READ_HIGH_PRIORITY; } - | DISTINCT - { - if (Select->options & SELECT_ALL) - { - yyerror(ER(ER_SYNTAX_ERROR)); - YYABORT; - } - Select->options|= SELECT_DISTINCT; - } + | DISTINCT { Select->options|= SELECT_DISTINCT; } | SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; } | SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; } | SQL_BUFFER_RESULT @@ -2509,15 +2508,7 @@ select_option: { Lex->select_lex.options|= OPTION_TO_QUERY_CACHE; } - | ALL - { - if (Select->options & SELECT_DISTINCT) - { - yyerror(ER(ER_SYNTAX_ERROR)); - YYABORT; - } - Select->options|= SELECT_ALL; - } + | ALL { Select->options|= SELECT_ALL; } ; select_lock_type: diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index f12cfe3256e..12c1ae905cf 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1251,7 +1251,7 @@ static uint my_numchars_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e) { - return (e-b)/2; + return (uint) (e-b)/2; } @@ -1261,7 +1261,8 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *e __attribute__((unused)), uint pos) { - return pos > e - b ? e - b + 2 : pos * 2; + uint string_length= (uint) (e - b); + return pos > string_length ? string_length + 2 : pos * 2; } @@ -1270,7 +1271,8 @@ uint my_well_formed_len_ucs2(CHARSET_INFO *cs __attribute__((unused)), const char *b, const char *e, uint nchars, int *error) { - uint nbytes= (e-b) & ~ (uint)1; + /* Ensure string length is dividable with 2 */ + uint nbytes= ((uint) (e-b)) & ~(uint) 1; *error= 0; nchars*= 2; return min(nbytes, nchars); -- cgit v1.2.1 From cdd6bc9bfeb1a82e7c7cfd8880f8e014ca5d9ff8 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 13 May 2005 23:08:29 +0300 Subject: Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) myisam/mi_key.c: Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) mysql-test/r/auto_increment.result: New test case mysql-test/t/auto_increment.test: New test case --- myisam/mi_key.c | 31 +++++++++++++++++++++---------- mysql-test/r/auto_increment.result | 14 ++++++++++++++ mysql-test/t/auto_increment.test | 12 ++++++++++++ 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/myisam/mi_key.c b/myisam/mi_key.c index 1688ab74823..06571c570e1 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -255,8 +255,25 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, } /* _mi_pack_key */ - /* Put a key in record */ - /* Used when only-keyread is wanted */ + +/* + Store found key in record + + SYNOPSIS + _mi_put_key_in_record() + info MyISAM handler + keynr Key number that was used + record Store key here + + Last read key is in info->lastkey + + NOTES + Used when only-keyread is wanted + + RETURN + 0 ok + 1 error +*/ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, byte *record) @@ -267,14 +284,8 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, byte *blob_ptr; DBUG_ENTER("_mi_put_key_in_record"); - if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY) - { - if (!(blob_ptr= - mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength, - &info->rec_buff))) - goto err; - } - key=(byte*) info->lastkey; + blob_ptr= info->lastkey2; /* Place to put blob parts */ + key=(byte*) info->lastkey; /* KEy that was read */ key_end=key+info->lastkey_length; for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++) { diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 2d6b058d9c5..9345c029127 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -131,3 +131,17 @@ a 1 2 drop table t1; +CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10))); +INSERT INTO t1 (b) VALUES ('aaaa'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 (b) VALUES (''); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 (b) VALUES ('bbbb'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index c26983b5eec..e699415a838 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -89,3 +89,15 @@ select last_insert_id(); insert into t1 values (NULL); select * from t1; drop table t1; + +# +# BUG #10045: Problem with composite AUTO_INCREMENT + BLOB key + +CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10))); +INSERT INTO t1 (b) VALUES ('aaaa'); +CHECK TABLE t1; +INSERT INTO t1 (b) VALUES (''); +CHECK TABLE t1; +INSERT INTO t1 (b) VALUES ('bbbb'); +CHECK TABLE t1; +DROP TABLE IF EXISTS t1; -- cgit v1.2.1 From 2059908b9ce2bde6848f247c4ee4a72a7e42738a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 14 May 2005 16:24:36 +0300 Subject: After merge fixes BitKeeper/deleted/.del-outfile2.result~fb702ee2518d8e6d: Delete: mysql-test/r/outfile2.result libmysql/libmysql.c: Fix indentation for new function mysql_set_character_set() mysql-test/r/alter_table.result: Fix test to be in same order as in 4.0 mysql-test/r/innodb.result: After merge fix mysql-test/r/insert_update.result: Add extra test for insert into ... on duplicate key upate mysql-test/r/outfile.result: After merge fix mysql-test/t/alter_table.test: Fix test to be in same order as in 4.0 mysql-test/t/insert_update.test: Add extra test for insert into ... on duplicate key upate mysql-test/t/outfile.test: After merge fix sql/item_func.cc: After merge fix sql/sql_table.cc: After merge fix --- libmysql/libmysql.c | 31 +++--- mysql-test/r/alter_table.result | 225 +++++++++++++++++++------------------- mysql-test/r/innodb.result | 2 +- mysql-test/r/insert_update.result | 9 +- mysql-test/r/outfile.result | Bin 683 -> 959 bytes mysql-test/r/outfile2.result | 10 -- mysql-test/t/alter_table.test | 102 ++++++++--------- mysql-test/t/insert_update.test | 6 +- mysql-test/t/outfile.test | 1 + sql/item_func.cc | 2 +- sql/sql_table.cc | 2 +- 11 files changed, 200 insertions(+), 190 deletions(-) delete mode 100644 mysql-test/r/outfile2.result diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 4c9f06df38e..ff90cfb6007 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1509,37 +1509,40 @@ const char * STDCALL mysql_character_set_name(MYSQL *mysql) return mysql->charset->csname; } + int STDCALL mysql_set_character_set(MYSQL *mysql, char *cs_name) { struct charset_info_st *cs; - const char *save_csdir = charsets_dir; + const char *save_csdir= charsets_dir; if (mysql->options.charset_dir) - charsets_dir = mysql->options.charset_dir; + charsets_dir= mysql->options.charset_dir; - if ( (cs = get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0))) ) + if ((cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0)))) { char buff[MY_CS_NAME_SIZE + 10]; - charsets_dir = save_csdir; + charsets_dir= save_csdir; sprintf(buff, "SET NAMES %s", cs_name); - if (!mysql_query(mysql, buff)) { - mysql->charset = cs; - } - } else { + if (!mysql_query(mysql, buff)) + { + mysql->charset= cs; + } + } + else + { char cs_dir_name[FN_REFLEN]; get_charsets_dir(cs_dir_name); - mysql->net.last_errno=CR_CANT_READ_CHARSET; + mysql->net.last_errno= CR_CANT_READ_CHARSET; strmov(mysql->net.sqlstate, unknown_sqlstate); - my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error)-1, - ER(mysql->net.last_errno), - cs_name, - cs_dir_name); + my_snprintf(mysql->net.last_error, sizeof(mysql->net.last_error) - 1, + ER(mysql->net.last_errno), cs_name, cs_dir_name); } - charsets_dir = save_csdir; + charsets_dir= save_csdir; return mysql->net.last_errno; } + uint STDCALL mysql_thread_safe(void) { #ifdef THREAD diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 6cada0d5fb2..b7d47a09bee 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -303,6 +303,120 @@ ALTER TABLE t1 DISABLE KEYS; INSERT DELAYED INTO t1 VALUES(1),(2),(3); ALTER TABLE t1 ENABLE KEYS; drop table t1; +CREATE TABLE t1 ( +Host varchar(16) binary NOT NULL default '', +User varchar(16) binary NOT NULL default '', +PRIMARY KEY (Host,User) +) ENGINE=MyISAM; +ALTER TABLE t1 DISABLE KEYS; +LOCK TABLES t1 WRITE; +INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty'); +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE +t1 0 PRIMARY 2 User A 3 NULL NULL BTREE +ALTER TABLE t1 ENABLE KEYS; +UNLOCK TABLES; +CHECK TABLES t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +Host varchar(16) binary NOT NULL default '', +User varchar(16) binary NOT NULL default '', +PRIMARY KEY (Host,User), +KEY (Host) +) ENGINE=MyISAM; +ALTER TABLE t1 DISABLE KEYS; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE +t1 0 PRIMARY 2 User A 0 NULL NULL BTREE +t1 1 Host 1 Host A NULL NULL NULL BTREE disabled +LOCK TABLES t1 WRITE; +INSERT INTO t1 VALUES ('localhost','root'),('localhost',''); +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE +t1 0 PRIMARY 2 User A 2 NULL NULL BTREE +t1 1 Host 1 Host A NULL NULL NULL BTREE disabled +ALTER TABLE t1 ENABLE KEYS; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE +t1 0 PRIMARY 2 User A 2 NULL NULL BTREE +t1 1 Host 1 Host A 1 NULL NULL BTREE +UNLOCK TABLES; +CHECK TABLES t1; +Table Op Msg_type Msg_text +test.t1 check status OK +LOCK TABLES t1 WRITE; +ALTER TABLE t1 RENAME t2; +UNLOCK TABLES; +select * from t2; +Host User +localhost +localhost root +DROP TABLE t2; +CREATE TABLE t1 ( +Host varchar(16) binary NOT NULL default '', +User varchar(16) binary NOT NULL default '', +PRIMARY KEY (Host,User), +KEY (Host) +) ENGINE=MyISAM; +LOCK TABLES t1 WRITE; +ALTER TABLE t1 DISABLE KEYS; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE +t1 0 PRIMARY 2 User A 0 NULL NULL BTREE +t1 1 Host 1 Host A NULL NULL NULL BTREE disabled +DROP TABLE t1; +create table t1 (a int); +alter table t1 rename to `t1\\`; +ERROR 42000: Incorrect table name 't1\\' +rename table t1 to `t1\\`; +ERROR 42000: Incorrect table name 't1\\' +drop table t1; +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +create table t1 ( a varchar(10) not null primary key ) engine=myisam; +create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1); +flush tables; +alter table t1 modify a varchar(10); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(10) NOT NULL default '', + PRIMARY KEY (`a`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) +flush tables; +alter table t1 modify a varchar(10) not null; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(10) NOT NULL default '', + PRIMARY KEY (`a`) +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) +drop table if exists t1, t2; +create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +show table status like 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +alter table t1 modify a int; +show table status like 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +drop table t1; +create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; +insert into t1 (a) values(1); +show table status like 't1'; +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment +t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +drop table t1; set names koi8r; create table t1 (a char(10) character set koi8r); insert into t1 values ('ÔÅÓÔ'); @@ -382,75 +496,6 @@ t1 CREATE TABLE `t1` ( `mytext` longtext character set latin1 collate latin1_general_cs ) ENGINE=MyISAM DEFAULT CHARSET=latin2 drop table t1; -CREATE TABLE t1 ( -Host varchar(16) binary NOT NULL default '', -User varchar(16) binary NOT NULL default '', -PRIMARY KEY (Host,User) -) ENGINE=MyISAM; -ALTER TABLE t1 DISABLE KEYS; -LOCK TABLES t1 WRITE; -INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty'); -SHOW INDEX FROM t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE -t1 0 PRIMARY 2 User A 3 NULL NULL BTREE -ALTER TABLE t1 ENABLE KEYS; -UNLOCK TABLES; -CHECK TABLES t1; -Table Op Msg_type Msg_text -test.t1 check status OK -DROP TABLE t1; -CREATE TABLE t1 ( -Host varchar(16) binary NOT NULL default '', -User varchar(16) binary NOT NULL default '', -PRIMARY KEY (Host,User), -KEY (Host) -) ENGINE=MyISAM; -ALTER TABLE t1 DISABLE KEYS; -SHOW INDEX FROM t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE -t1 0 PRIMARY 2 User A 0 NULL NULL BTREE -t1 1 Host 1 Host A NULL NULL NULL BTREE disabled -LOCK TABLES t1 WRITE; -INSERT INTO t1 VALUES ('localhost','root'),('localhost',''); -SHOW INDEX FROM t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE -t1 0 PRIMARY 2 User A 2 NULL NULL BTREE -t1 1 Host 1 Host A NULL NULL NULL BTREE disabled -ALTER TABLE t1 ENABLE KEYS; -SHOW INDEX FROM t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE -t1 0 PRIMARY 2 User A 2 NULL NULL BTREE -t1 1 Host 1 Host A 1 NULL NULL BTREE -UNLOCK TABLES; -CHECK TABLES t1; -Table Op Msg_type Msg_text -test.t1 check status OK -LOCK TABLES t1 WRITE; -ALTER TABLE t1 RENAME t2; -UNLOCK TABLES; -select * from t2; -Host User -localhost -localhost root -DROP TABLE t2; -CREATE TABLE t1 ( -Host varchar(16) binary NOT NULL default '', -User varchar(16) binary NOT NULL default '', -PRIMARY KEY (Host,User), -KEY (Host) -) ENGINE=MyISAM; -LOCK TABLES t1 WRITE; -ALTER TABLE t1 DISABLE KEYS; -SHOW INDEX FROM t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE -t1 0 PRIMARY 2 User A 0 NULL NULL BTREE -t1 1 Host 1 Host A NULL NULL NULL BTREE disabled -DROP TABLE t1; CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE); ALTER TABLE t1 DROP PRIMARY KEY; SHOW CREATE TABLE t1; @@ -469,12 +514,6 @@ alter table t1 drop key no_such_key; ERROR 42000: Can't DROP 'no_such_key'; check that column/key exists alter table t1 drop key a; drop table t1; -create table t1 (a int); -alter table t1 rename to `t1\\`; -ERROR 42000: Incorrect table name 't1\\' -rename table t1 to `t1\\`; -ERROR 42000: Incorrect table name 't1\\' -drop table t1; create table t1 (a text) character set koi8r; insert into t1 values (_koi8r'ÔÅÓÔ'); select hex(a) from t1; @@ -489,39 +528,3 @@ create table t1 ( a timestamp ); alter table t1 add unique ( a(1) ); ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys drop table t1; -drop table if exists t1, t2; -create table t1 ( a varchar(10) not null primary key ) engine=myisam; -create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1); -flush tables; -alter table t1 modify a varchar(10); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` varchar(10) NOT NULL default '', - PRIMARY KEY (`a`) -) TYPE=MRG_MyISAM UNION=(t1) -flush tables; -alter table t1 modify a varchar(10) not null; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` varchar(10) NOT NULL default '', - PRIMARY KEY (`a`) -) TYPE=MRG_MyISAM UNION=(t1) -drop table if exists t1, t2; -create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; -insert into t1 (a) values(1); -show table status like 't1'; -Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment -t1 MyISAM Fixed 1 37 37 X X X X X X X X -alter table t1 modify a int; -show table status like 't1'; -Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment -t1 MyISAM Fixed 1 37 37 X X X X X X X X -drop table t1; -create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; -insert into t1 (a) values(1); -show table status like 't1'; -Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment -t1 MyISAM Fixed 1 37 37 X X X X X X X X -drop table t1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index def462fb521..4c983014d4b 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1645,5 +1645,5 @@ concat(a, b) drop table t1; CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); -The used table type doesn't support FULLTEXT indexes +ERROR HY000: The used table type doesn't support FULLTEXT indexes DROP TABLE t1; diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index f78372541f2..2143538469b 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -167,7 +167,7 @@ a b c VALUES(a) 2 1 11 NULL DROP TABLE t1; DROP TABLE t2; -create table t1 (a int not null unique); +create table t1 (a int not null unique) engine=myisam; insert into t1 values (1),(2); insert ignore into t1 select 1 on duplicate key update a=2; select * from t1; @@ -179,4 +179,11 @@ select * from t1; a 1 3 +insert into t1 select 1 on duplicate key update a=2; +select * from t1; +a +2 +3 +insert into t1 select a from t1 on duplicate key update a=a+1 ; +ERROR 23000: Duplicate entry '3' for key 1 drop table t1; diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result index a7871592241..5eb24a78ef0 100644 Binary files a/mysql-test/r/outfile.result and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/r/outfile2.result b/mysql-test/r/outfile2.result deleted file mode 100644 index 4dc09f65b7c..00000000000 --- a/mysql-test/r/outfile2.result +++ /dev/null @@ -1,10 +0,0 @@ -drop table if exists t1; -CREATE TABLE t1 (a INT); -EXPLAIN -SELECT * -INTO OUTFILE '/tmp/t1.txt' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' - FROM t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found -DROP TABLE t1; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index d133403f42b..c3ba2c8a7a4 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -165,56 +165,6 @@ INSERT DELAYED INTO t1 VALUES(1),(2),(3); ALTER TABLE t1 ENABLE KEYS; drop table t1; -# -# Test that data get converted when character set is changed -# Test that data doesn't get converted when src or dst is BINARY/BLOB -# -set names koi8r; -create table t1 (a char(10) character set koi8r); -insert into t1 values ('ÔÅÓÔ'); -select a,hex(a) from t1; -alter table t1 change a a char(10) character set cp1251; -select a,hex(a) from t1; -alter table t1 change a a binary(10); -select a,hex(a) from t1; -alter table t1 change a a char(10) character set cp1251; -select a,hex(a) from t1; -alter table t1 change a a char(10) character set koi8r; -select a,hex(a) from t1; -alter table t1 change a a varchar(10) character set cp1251; -select a,hex(a) from t1; -alter table t1 change a a char(10) character set koi8r; -select a,hex(a) from t1; -alter table t1 change a a text character set cp1251; -select a,hex(a) from t1; -alter table t1 change a a char(10) character set koi8r; -select a,hex(a) from t1; -delete from t1; - -# -# Test ALTER TABLE .. CHARACTER SET .. -# -show create table t1; -alter table t1 DEFAULT CHARACTER SET latin1; -show create table t1; -alter table t1 CONVERT TO CHARACTER SET latin1; -show create table t1; -alter table t1 DEFAULT CHARACTER SET cp1251; -show create table t1; - -drop table t1; - -# -# Bug#2821 -# Test that table CHARACTER SET does not affect blobs -# -create table t1 (myblob longblob,mytext longtext) -default charset latin1 collate latin1_general_cs; -show create table t1; -alter table t1 character set latin2; -show create table t1; -drop table t1; - # # Test ALTER TABLE ENABLE/DISABLE keys when things are locked # @@ -317,6 +267,58 @@ insert into t1 (a) values(1); --replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X show table status like 't1'; drop table t1; + +# +# Test that data get converted when character set is changed +# Test that data doesn't get converted when src or dst is BINARY/BLOB +# +set names koi8r; +create table t1 (a char(10) character set koi8r); +insert into t1 values ('ÔÅÓÔ'); +select a,hex(a) from t1; +alter table t1 change a a char(10) character set cp1251; +select a,hex(a) from t1; +alter table t1 change a a binary(10); +select a,hex(a) from t1; +alter table t1 change a a char(10) character set cp1251; +select a,hex(a) from t1; +alter table t1 change a a char(10) character set koi8r; +select a,hex(a) from t1; +alter table t1 change a a varchar(10) character set cp1251; +select a,hex(a) from t1; +alter table t1 change a a char(10) character set koi8r; +select a,hex(a) from t1; +alter table t1 change a a text character set cp1251; +select a,hex(a) from t1; +alter table t1 change a a char(10) character set koi8r; +select a,hex(a) from t1; +delete from t1; + +# +# Test ALTER TABLE .. CHARACTER SET .. +# +show create table t1; +alter table t1 DEFAULT CHARACTER SET latin1; +show create table t1; +alter table t1 CONVERT TO CHARACTER SET latin1; +show create table t1; +alter table t1 DEFAULT CHARACTER SET cp1251; +show create table t1; + +drop table t1; + +# +# Bug#2821 +# Test that table CHARACTER SET does not affect blobs +# +create table t1 (myblob longblob,mytext longtext) +default charset latin1 collate latin1_general_cs; +show create table t1; +alter table t1 character set latin2; +show create table t1; +drop table t1; + +# # Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY) # diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 0fa366586b3..f5857840588 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -85,10 +85,14 @@ DROP TABLE t2; # Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update" # INSERT INGORE...UPDATE gives bad error or breaks protocol. # -create table t1 (a int not null unique); +create table t1 (a int not null unique) engine=myisam; insert into t1 values (1),(2); insert ignore into t1 select 1 on duplicate key update a=2; select * from t1; insert ignore into t1 select a from t1 on duplicate key update a=a+1 ; select * from t1; +insert into t1 select 1 on duplicate key update a=2; +select * from t1; +--error 1062 +insert into t1 select a from t1 on duplicate key update a=a+1 ; drop table t1; diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index b029a65284c..4b12f9e4e50 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -38,6 +38,7 @@ select load_file(concat(@tmpdir,"/outfile-test.3")); #--error 1086 #eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1; #enable_query_log; +--error 13,2 select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1 --exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2 diff --git a/sql/item_func.cc b/sql/item_func.cc index 8aa3526bbef..05b76eb1604 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3176,7 +3176,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref) table=((Item_field *)item)->field->table; if (!(table->file->table_flags() & HA_CAN_FULLTEXT)) { - my_error(ER_TABLE_CANT_HANDLE_FULLTEXT, MYF(0)); + my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0)); return 1; } table->fulltext_searched=1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7b0f24bcc45..67aade519f5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1205,6 +1205,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, /* Sort keys in optimized order */ qsort((gptr) key_info_buffer, *key_count, sizeof(KEY), (qsort_cmp) sort_keys); + create_info->null_bits= null_fields; DBUG_RETURN(0); } @@ -1392,7 +1393,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) create_info->data_file_name= create_info->index_file_name= 0; create_info->table_options=db_options; - create_info->null_bits= null_fields; if (rea_create_table(thd, path, create_info, fields, key_count, key_info_buffer)) -- cgit v1.2.1 From d15f89c47afd2b674e666098eee69ec8bdfb901d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 May 2005 15:21:35 +0300 Subject: After merge fixes mysql-test/r/alter_table.result: Fixed results after merge sql/handler.cc: Trivial optimzation sql/sql_table.cc: Trvial optimization sql/sql_yacc.yy: After merge fix sql/unireg.cc: Removed argument 'null_fields' from make_empty_rec() as it was not needed Moved assert() to right place to take bit fields into account --- mysql-test/r/alter_table.result | 19 ++++++++++++++----- sql/handler.cc | 7 ++++--- sql/sql_table.cc | 7 ++++--- sql/sql_yacc.yy | 2 +- sql/unireg.cc | 12 +++++------- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index e91a164db6f..74f0e3d9425 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -389,7 +389,7 @@ alter table t1 modify a varchar(10); show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(10) NOT NULL default '', + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) flush tables; @@ -397,7 +397,7 @@ alter table t1 modify a varchar(10) not null; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` varchar(10) NOT NULL default '', + `a` varchar(10) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`) drop table if exists t1, t2; @@ -405,17 +405,26 @@ create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, p insert into t1 (a) values(1); show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL alter table t1 modify a int; show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL drop table t1; create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM; insert into t1 (a) values(1); +Warnings: +Warning 1364 Field 'b' doesn't have a default value +Warning 1364 Field 'c' doesn't have a default value +Warning 1364 Field 'd' doesn't have a default value +Warning 1364 Field 'e' doesn't have a default value +Warning 1364 Field 'f' doesn't have a default value +Warning 1364 Field 'g' doesn't have a default value +Warning 1364 Field 'h' doesn't have a default value +Warning 1364 Field 'i' doesn't have a default value show table status like 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 MyISAM 9 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL +t1 MyISAM 10 Fixed 1 37 X X X X X X X X latin1_swedish_ci NULL drop table t1; set names koi8r; create table t1 (a char(10) character set koi8r); diff --git a/sql/handler.cc b/sql/handler.cc index a34b3bd8aac..d641628ac86 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1420,6 +1420,7 @@ void handler::update_auto_increment() ulonglong nr; THD *thd= table->in_use; struct system_variables *variables= &thd->variables; + bool auto_increment_field_not_null; DBUG_ENTER("handler::update_auto_increment"); /* @@ -1427,13 +1428,14 @@ void handler::update_auto_increment() row was not inserted */ thd->prev_insert_id= thd->next_insert_id; + auto_increment_field_not_null= table->auto_increment_field_not_null; + table->auto_increment_field_not_null= FALSE; if ((nr= table->next_number_field->val_int()) != 0 || - table->auto_increment_field_not_null && + auto_increment_field_not_null && thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) { /* Clear flag for next row */ - table->auto_increment_field_not_null= FALSE; /* Mark that we didn't generate a new value **/ auto_increment_column_changed=0; @@ -1449,7 +1451,6 @@ void handler::update_auto_increment() } DBUG_VOID_RETURN; } - table->auto_increment_field_not_null= FALSE; if (!(nr= thd->next_insert_id)) { nr= get_auto_increment(); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b6e44f8ec25..4ddef3fc653 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -640,7 +640,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { const char *key_name; create_field *sql_field,*dup_field; - uint field,null_fields,blob_columns; + uint field,null_fields,blob_columns,max_key_length; ulong record_offset= 0; KEY *key_info; KEY_PART_INFO *key_part_info; @@ -654,6 +654,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, select_field_pos= fields->elements - select_field_count; null_fields=blob_columns=0; create_info->varchar= 0; + max_key_length= file->max_key_length(); for (field_no=0; (sql_field=it++) ; field_no++) { @@ -1190,10 +1191,10 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, { if (f_is_blob(sql_field->pack_flag)) { - if ((length=column->length) > file->max_key_length() || + if ((length=column->length) > max_key_length || length > file->max_key_part_length()) { - length=min(file->max_key_length(), file->max_key_part_length()); + length=min(max_key_length, file->max_key_part_length()); if (key->type == Key::MULTIPLE) { /* not a critical problem */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 21a9d344e22..9328d7345c3 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3990,7 +3990,7 @@ select_options: { if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT)) { - net_printf(Lex->thd, ER_WRONG_USAGE, "ALL", "DISTINCT"); + my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"); YYABORT; } } diff --git a/sql/unireg.cc b/sql/unireg.cc index 82f91d1da68..da463885f85 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -45,8 +45,7 @@ static bool pack_fields(File file, List &create_fields, static bool make_empty_rec(THD *thd, int file, enum db_type table_type, uint table_options, List &create_fields, - uint reclength, uint null_fields, - ulong data_offset); + uint reclength, ulong data_offset); /* Create a frm (table definition) file @@ -72,7 +71,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, uint keys, KEY *key_info, handler *db_file) { - uint reclength,info_length,screens,key_info_length,maxlength,null_fields; + uint reclength,info_length,screens,key_info_length,maxlength; File file; ulong filepos, data_offset; uchar fileinfo[64],forminfo[288],*keybuff; @@ -111,7 +110,6 @@ bool mysql_create_frm(THD *thd, my_string file_name, } } reclength=uint2korr(forminfo+266); - null_fields=uint2korr(forminfo+282); if ((file=create_frm(file_name, reclength, fileinfo, create_info, keys)) < 0) @@ -145,7 +143,7 @@ bool mysql_create_frm(THD *thd, my_string file_name, (ulong) uint2korr(fileinfo+6)+ (ulong) key_buff_length, MY_SEEK_SET,MYF(0))); if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options, - create_fields,reclength, null_fields, data_offset)) + create_fields,reclength, data_offset)) goto err; VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0))); @@ -661,7 +659,7 @@ static bool pack_fields(File file, List &create_fields, static bool make_empty_rec(THD *thd, File file,enum db_type table_type, uint table_options, List &create_fields, - uint reclength, uint null_fields, + uint reclength, ulong data_offset) { int error; @@ -696,7 +694,6 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, null_count++; // Need one bit for delete mark *buff|= 1; } - DBUG_ASSERT(data_offset == ((null_fields + null_count + 7) / 8)); null_pos= buff; List_iterator it(create_fields); @@ -756,6 +753,7 @@ static bool make_empty_rec(THD *thd, File file,enum db_type table_type, else regfield->reset(); } + DBUG_ASSERT(data_offset == ((null_count + 7) / 8)); /* Fill not used startpos */ if (null_count) -- cgit v1.2.1