List:Internals« Previous MessageNext Message »
From:gluh Date:July 8 2005 10:38am
Subject:bk commit into 5.0 tree (gluh:1.1896) BUG#11057
View as plain text  
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.1896 05/07/08 13:38:13 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.253 05/07/08 13:38:08 gluh@stripped +18 -4
    Fix for bug#11057 information_schema: columns table has some questionable contents

  mysql-test/t/information_schema.test
    1.43 05/07/08 13:38:08 gluh@stripped +16 -0
    Fix for bug#11057 information_schema: columns table has some questionable contents

  mysql-test/r/information_schema.result
    1.61 05/07/08 13:38:08 gluh@stripped +25 -2
    Fix for bug#11057 information_schema: columns table has some questionable contents

# 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.252/sql/sql_show.cc	Wed Jul  6 05:03:43 2005
+++ 1.253/sql/sql_show.cc	Fri Jul  8 13:38:08 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.60/mysql-test/r/information_schema.result	Thu Jul  7 14:15:25 2005
+++ 1.61/mysql-test/r/information_schema.result	Fri Jul  8 13:38:08 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	
@@ -520,7 +520,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;
@@ -841,3 +841,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.42/mysql-test/t/information_schema.test	Wed Jul  6 03:24:32 2005
+++ 1.43/mysql-test/t/information_schema.test	Fri Jul  8 13:38:08 2005
@@ -569,3 +569,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;
Thread
bk commit into 5.0 tree (gluh:1.1896) BUG#11057gluh8 Jul