List:Commits« Previous MessageNext Message »
From:timour Date:February 22 2006 9:04am
Subject:bk commit into 5.0 tree (timour:1.2049) BUG#17523
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of timka. When timka 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.2049 06/02/22 10:04:10 timour@stripped +3 -0
  Fix for BUG#17523: natural join and information schema.
  
  The cause of the bug was an ASSERT that checked the consistency
  of TABLE_SHARE::db and TABLE_LIST::db and failed for I_S tables.
  The fix relaxes the requirement for consistency for I_S.

  sql/table.cc
    1.216 06/02/22 10:04:07 timour@stripped +17 -2
    Take into account that for I_S tables, TABLE_SHARE::db == 0,
    while TABLE_LIST::db contains the database name of a table.
    The only change is in the ASSERTs.

  mysql-test/t/join.test
    1.30 06/02/22 10:04:07 timour@stripped +6 -0
    Added test for BUG#17523

  mysql-test/r/join.result
    1.35 06/02/22 10:04:07 timour@stripped +5 -0
    Added test for BUG#17523

# 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:	timour
# Host:	lamia.home
# Root:	/home/timka/mysql/src/5.0-bug-17523

--- 1.215/sql/table.cc	2006-01-19 13:12:37 +02:00
+++ 1.216/sql/table.cc	2006-02-22 10:04:07 +02:00
@@ -2595,8 +2595,15 @@
   if (view_field)
     return table_ref->view_db.str;
 
+  /*
+    Test that TABLE_LIST::db is the same as st_table_share::db to
+    ensure consistency. An exception are I_S schema tables, which
+    are inconsistent in this respect.
+  */
   DBUG_ASSERT(!strcmp(table_ref->db,
-                      table_ref->table->s->db));
+                      table_ref->table->s->db) ||
+              (table_ref->schema_table &&
+               table_ref->table->s->db[0] == 0));
   return table_ref->db;
 }
 
@@ -2798,7 +2805,15 @@
   else if (table_ref->is_natural_join)
     return natural_join_it.column_ref()->db_name();
 
-  DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db));
+  /*
+    Test that TABLE_LIST::db is the same as st_table_share::db to
+    ensure consistency. An exception are I_S schema tables, which
+    are inconsistent in this respect.
+  */
+  DBUG_ASSERT(!strcmp(table_ref->db, table_ref->table->s->db) ||
+              (table_ref->schema_table &&
+               table_ref->table->s->db[0] == 0));
+
   return table_ref->db;
 }
 

--- 1.34/mysql-test/r/join.result	2005-11-30 19:13:25 +02:00
+++ 1.35/mysql-test/r/join.result	2006-02-22 10:04:07 +02:00
@@ -677,6 +677,11 @@
 ERROR 42S22: Unknown column 't1.b' in 'field list'
 select * from v1a join v1b on t1.b = t2.b;
 ERROR 42S22: Unknown column 't1.b' in 'on clause'
+select * from information_schema.statistics join information_schema.columns
+using(table_name,column_name) where table_name='user';
+TABLE_NAME	COLUMN_NAME	TABLE_CATALOG	TABLE_SCHEMA	NON_UNIQUE	INDEX_SCHEMA	INDEX_NAME	SEQ_IN_INDEX	COLLATION	CARDINALITY	SUB_PART	PACKED	NULLABLE	INDEX_TYPE	COMMENT	TABLE_CATALOG	TABLE_SCHEMA	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
+user	Host	NULL	mysql	0	mysql	PRIMARY	1	A	NULL	NULL	NULL		BTREE		NULL	mysql	1		NO	char	20	60	NULL	NULL	utf8	utf8_bin	char(60)	PRI		select,insert,update,references	
+user	User	NULL	mysql	0	mysql	PRIMARY	2	A	5	NULL	NULL		BTREE		NULL	mysql	2		NO	char	5	16	NULL	NULL	utf8	utf8_bin	char(16)	PRI		select,insert,update,references	
 drop table t1;
 drop table t2;
 drop table t3;

--- 1.29/mysql-test/t/join.test	2005-11-30 19:13:25 +02:00
+++ 1.30/mysql-test/t/join.test	2006-02-22 10:04:07 +02:00
@@ -523,6 +523,12 @@
 -- error 1054
 select * from v1a join v1b on t1.b = t2.b;
 
+#
+# Bug #17523 natural join and information_schema
+#
+select * from information_schema.statistics join information_schema.columns
+              using(table_name,column_name) where table_name='user';
+
 drop table t1;
 drop table t2;
 drop table t3;
Thread
bk commit into 5.0 tree (timour:1.2049) BUG#17523timour22 Feb