summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2006-02-22 10:04:10 +0200
committerunknown <timour@mysql.com>2006-02-22 10:04:10 +0200
commit475797a34622bb740409238f9ee63a5777476b4f (patch)
tree4a5a2a2b3a5bbaa7697e835edb2bd20086f5fddc /sql/table.cc
parent86c920ba776ddf5e9999e8293d5824be25bb43b6 (diff)
downloadmariadb-git-475797a34622bb740409238f9ee63a5777476b4f.tar.gz
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. mysql-test/r/join.result: Added test for BUG#17523 mysql-test/t/join.test: Added test for BUG#17523 sql/table.cc: 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.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 9ae5348b5c6..1a2c2b8f073 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2595,8 +2595,15 @@ const char *Natural_join_column::db_name()
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 @@ const char *Field_iterator_table_ref::db_name()
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;
}