From: Date: July 19 2005 11:30am Subject: bk commit into 5.0 tree (gluh:1.1954) BUG#11057 List-Archive: http://lists.mysql.com/internals/27290 X-Bug: 11057 Message-Id: <200507190930.j6J9UcSa013844@eagle.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.0 repository of gluh. When gluh does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1954 05/07/19 14:30:32 gluh@stripped +3 -0 Fix for bug#11057 information_schema: columns table has some questionable contents fixed BLOB, TEXT(wrong maximum length), BIT and integer types(wrong numeric_precision value) sql/sql_show.cc 1.255 05/07/19 14:30:27 gluh@stripped +18 -4 Fix for bug#11057 information_schema: columns table has some questionable contents fixed BLOB, TEXT(wrong maximum length), BIT and integer types(wrong numeric_precision value) mysql-test/t/information_schema.test 1.44 05/07/19 14:30:27 gluh@stripped +16 -0 Fix for bug#11057 information_schema: columns table has some questionable contents fixed BLOB, TEXT(wrong maximum length), BIT and integer types(wrong numeric_precision value) mysql-test/r/information_schema.result 1.62 05/07/19 14:30:27 gluh@stripped +25 -2 Fix for bug#11057 information_schema: columns table has some questionable contents fixed BLOB, TEXT(wrong maximum length), BIT and integer types(wrong numeric_precision value) # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: gluh # Host: eagle.intranet.mysql.r18.ru # Root: /home/gluh/MySQL/Merge/5.0 --- 1.254/sql/sql_show.cc Mon Jul 18 20:36:17 2005 +++ 1.255/sql/sql_show.cc Tue Jul 19 14:30:27 2005 @@ -2377,6 +2377,7 @@ { const char *tmp_buff; byte *pos; + bool is_blob; uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; char tmp1[MAX_FIELD_WIDTH]; @@ -2455,12 +2456,14 @@ "NO" : "YES"); table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); - if (field->has_charset()) + is_blob= (field->type() == FIELD_TYPE_BLOB); + if (field->has_charset() || is_blob) { - table->field[8]->store((longlong) field->field_length/ - field->charset()->mbmaxlen); + longlong c_octet_len= is_blob ? (longlong) field->max_length() : + (longlong) field->max_length()/field->charset()->mbmaxlen; + table->field[8]->store(c_octet_len); table->field[8]->set_notnull(); - table->field[9]->store((longlong) field->field_length); + table->field[9]->store((longlong) field->max_length()); table->field[9]->set_notnull(); } @@ -2488,6 +2491,17 @@ case FIELD_TYPE_LONG: case FIELD_TYPE_LONGLONG: case FIELD_TYPE_INT24: + { + table->field[10]->store((longlong) field->max_length() - 1); + table->field[10]->set_notnull(); + break; + } + case FIELD_TYPE_BIT: + { + table->field[10]->store((longlong) field->max_length()); + table->field[10]->set_notnull(); + break; + } case FIELD_TYPE_FLOAT: case FIELD_TYPE_DOUBLE: { --- 1.61/mysql-test/r/information_schema.result Tue Jul 19 13:48:40 2005 +++ 1.62/mysql-test/r/information_schema.result Tue Jul 19 14:30:27 2005 @@ -153,7 +153,7 @@ select * from information_schema.COLUMNS where table_name="t1" and column_name= "a"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT -NULL mysqltest t1 a 1 NULL YES int NULL NULL 11 0 NULL NULL int(11) select,insert,update,references +NULL mysqltest t1 a 1 NULL YES int NULL NULL 10 NULL NULL NULL int(11) select,insert,update,references show columns from mysqltest.t1 where field like "%a%"; Field Type Null Key Default Extra a int(11) YES NULL @@ -523,7 +523,7 @@ d decimal(6,4) NULL NULL 6 4 e float NULL NULL 12 NULL f decimal(6,3) NULL NULL 6 3 -g int(11) NULL NULL 11 0 +g int(11) NULL NULL 10 NULL h double(10,3) NULL NULL 10 3 i double NULL NULL 22 NULL drop table t1; @@ -844,3 +844,26 @@ show create database information_schema; Database Create Database information_schema CREATE DATABASE `information_schema` /*!40100 DEFAULT CHARACTER SET utf8 */ +create table t1(f1 LONGBLOB, f2 LONGTEXT); +select column_name,data_type,CHARACTER_OCTET_LENGTH, +CHARACTER_MAXIMUM_LENGTH +from information_schema.columns +where table_name='t1'; +column_name data_type CHARACTER_OCTET_LENGTH CHARACTER_MAXIMUM_LENGTH +f1 longblob 4294967295 4294967295 +f2 longtext 4294967295 4294967295 +drop table t1; +create table t1(f1 tinyint, f2 SMALLINT, f3 mediumint, f4 int, +f5 BIGINT, f6 BIT, f7 bit(64)); +select column_name, NUMERIC_PRECISION, NUMERIC_SCALE +from information_schema.columns +where table_name='t1'; +column_name NUMERIC_PRECISION NUMERIC_SCALE +f1 3 NULL +f2 5 NULL +f3 7 NULL +f4 10 NULL +f5 19 NULL +f6 1 NULL +f7 64 NULL +drop table t1; --- 1.43/mysql-test/t/information_schema.test Tue Jul 19 13:48:40 2005 +++ 1.44/mysql-test/t/information_schema.test Tue Jul 19 14:30:27 2005 @@ -571,3 +571,19 @@ # Bug #9434 SHOW CREATE DATABASE information_schema; # show create database information_schema; + +# +# Bug #11057 information_schema: columns table has some questionable contents +# +create table t1(f1 LONGBLOB, f2 LONGTEXT); +select column_name,data_type,CHARACTER_OCTET_LENGTH, + CHARACTER_MAXIMUM_LENGTH +from information_schema.columns +where table_name='t1'; +drop table t1; +create table t1(f1 tinyint, f2 SMALLINT, f3 mediumint, f4 int, + f5 BIGINT, f6 BIT, f7 bit(64)); +select column_name, NUMERIC_PRECISION, NUMERIC_SCALE +from information_schema.columns +where table_name='t1'; +drop table t1;