From: Date: March 31 2005 10:44am Subject: bk commit into 5.0 tree (gluh:1.1843) BUG#9344 List-Archive: http://lists.mysql.com/internals/23520 X-Bug: 9344 Message-Id: <200503310844.j2V8imBA031923@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.1843 05/03/31 13:44:42 gluh@stripped +4 -0 Fix for bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns The columns CHARACTER_MAXIMUM_LENGTH and CHARACTER_OCTET_LENGTH of INFORMATION_SCHEMA.COLUMNS must be NULL for numeric columns BitKeeper/etc/logging_ok 1.311 05/03/31 13:44:34 gluh@stripped +1 -0 Logging to logging@stripped accepted sql/sql_show.cc 1.230 05/03/31 13:43:21 gluh@stripped +22 -8 Fix for bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns mysql-test/t/information_schema.test 1.30 05/03/31 13:43:21 gluh@stripped +18 -0 Fix for bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns mysql-test/r/information_schema.result 1.44 05/03/31 13:43:21 gluh@stripped +32 -10 Fix for bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns # 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/Bugs/mysql-5.0.9344 --- 1.229/sql/sql_show.cc Fri Mar 25 16:09:15 2005 +++ 1.230/sql/sql_show.cc Thu Mar 31 13:43:21 2005 @@ -2333,12 +2333,26 @@ "NO" : "YES"); table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); - if (field->has_charset()) - table->field[8]->store((longlong) field->representation_length()/ - field->charset()->mbmaxlen); - else - table->field[8]->store((longlong) field->representation_length()); - table->field[9]->store((longlong) field->representation_length()); + + switch (field->type()) { + case FIELD_TYPE_TINY_BLOB: + case FIELD_TYPE_MEDIUM_BLOB: + case FIELD_TYPE_LONG_BLOB: + case FIELD_TYPE_BLOB: + case FIELD_TYPE_VAR_STRING: + case FIELD_TYPE_STRING: + if (field->has_charset()) + table->field[8]->store((longlong) field->representation_length()/ + field->charset()->mbmaxlen); + else + table->field[8]->store((longlong) field->representation_length()); + table->field[8]->set_notnull(); + table->field[9]->store((longlong) field->representation_length()); + table->field[9]->set_notnull(); + break; + default: + break; + } { uint dec =field->decimals(); @@ -3514,8 +3528,8 @@ {"COLUMN_DEFAULT", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Default"}, {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null"}, {"DATA_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, - {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0}, - {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0}, + {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, + {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0}, --- 1.310/BitKeeper/etc/logging_ok Wed Mar 30 17:13:56 2005 +++ 1.311/BitKeeper/etc/logging_ok Thu Mar 31 13:44:34 2005 @@ -56,6 +56,7 @@ georg@stripped georg@stripped gerberb@stripped +gluh@stripped gluh@gluh.(none) gluh@stripped gordon@stripped --- 1.43/mysql-test/r/information_schema.result Fri Mar 25 16:09:14 2005 +++ 1.44/mysql-test/r/information_schema.result Thu Mar 31 13:43:21 2005 @@ -133,7 +133,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 testtets t1 a 1 NULL YES int 11 11 11 0 NULL NULL int(11) select,insert,update,references +NULL testtets t1 a 1 NULL YES int NULL NULL 11 0 NULL NULL int(11) select,insert,update,references show columns from testtets.t1 where field like "%a%"; Field Type Null Key Default Extra a int(11) YES NULL @@ -476,15 +476,15 @@ CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE from information_schema.columns where table_name= 't1'; COLUMN_NAME COLUMN_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE -a decimal(5,3) 7 7 5 3 -b decimal(5,1) 7 7 5 1 -c float(5,2) 5 5 5 2 -d decimal(6,4) 8 8 6 4 -e float 12 12 12 NULL -f decimal(6,3) 8 8 6 3 -g int(11) 11 11 11 0 -h double(10,3) 10 10 10 3 -i double 22 22 22 NULL +a decimal(5,3) NULL NULL 5 3 +b decimal(5,1) NULL NULL 5 1 +c float(5,2) NULL NULL 5 2 +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 +h double(10,3) NULL NULL 10 3 +i double NULL NULL 22 NULL drop table t1; create table t115 as select table_name, column_name, column_type from information_schema.columns where table_name = 'proc'; @@ -678,3 +678,25 @@ AND A.TABLE_NAME = B.TABLE_NAME); COUNT(*) 0 +create table t1 +( x_bigint BIGINT, +x_integer INTEGER, +x_smallint SMALLINT, +x_decimal DECIMAL(5,3), +x_numeric NUMERIC(5,3), +x_real REAL, +x_float FLOAT, +x_double_precision DOUBLE PRECISION ); +SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH +FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME= 't1'; +COLUMN_NAME CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH +x_bigint NULL NULL +x_integer NULL NULL +x_smallint NULL NULL +x_decimal NULL NULL +x_numeric NULL NULL +x_real NULL NULL +x_float NULL NULL +x_double_precision NULL NULL +drop table t1; --- 1.29/mysql-test/t/information_schema.test Thu Mar 24 17:32:04 2005 +++ 1.30/mysql-test/t/information_schema.test Thu Mar 31 13:43:21 2005 @@ -432,3 +432,21 @@ (SELECT * FROM INFORMATION_SCHEMA.COLUMNS B WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME); + +# +# Bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns +# + +create table t1 +( x_bigint BIGINT, + x_integer INTEGER, + x_smallint SMALLINT, + x_decimal DECIMAL(5,3), + x_numeric NUMERIC(5,3), + x_real REAL, + x_float FLOAT, + x_double_precision DOUBLE PRECISION ); +SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH +FROM INFORMATION_SCHEMA.COLUMNS +WHERE TABLE_NAME= 't1'; +drop table t1;