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.1847 05/03/24 16:32:11 gluh@stripped +5 -0
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
there was no check of result of
table->file->write_row() function. When count of rows was
more than table max_rows(HEAP table) the following recodrs
were not inserted to the table
-'schema_table_store_record' function is added.
The function checks result of write_row function
and convert HEAP table to MyISAM if necessary
- Result check after write_row is added into all
I_S function which store the records to I_S tables
sql/table.h
1.93 05/03/24 16:32:04 gluh@stripped +2 -0
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
sql/sql_show.cc
1.226 05/03/24 16:32:04 gluh@stripped +101 -32
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
sql/sql_select.cc
1.304 05/03/24 16:32:04 gluh@stripped +3 -2
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
mysql-test/t/information_schema.test
1.29 05/03/24 16:32:04 gluh@stripped +1 -0
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
mysql-test/r/information_schema.result
1.41 05/03/24 16:32:04 gluh@stripped +2 -0
Bug #9317: Wrong count for tables in INFORMATION_SCHEMA
# 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: gluh.mysql.r18.ru
# Root: /home/gluh/MySQL-MERGE/mysql-5.0
--- 1.303/sql/sql_select.cc Tue Mar 22 00:46:07 2005
+++ 1.304/sql/sql_select.cc Thu Mar 24 16:32:04 2005
@@ -8714,8 +8714,9 @@
*table= new_table;
table->s= &table->share_not_to_be_used;
table->file->change_table_ptr(table);
- thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ?
- "Copying to tmp table on disk" : save_proc_info);
+ if (save_proc_info)
+ thd->proc_info= (!strcmp(save_proc_info,"Copying to tmp table") ?
+ "Copying to tmp table on disk" : save_proc_info);
DBUG_RETURN(0);
err:
--- 1.225/sql/sql_show.cc Wed Mar 16 17:10:55 2005
+++ 1.226/sql/sql_show.cc Thu Mar 24 16:32:04 2005
@@ -41,6 +41,7 @@
store_create_info(THD *thd, TABLE_LIST *table_list, String *packet);
static int
view_store_create_info(THD *thd, TABLE_LIST *table, String *packet);
+static bool schema_table_store_record(THD *thd, TABLE *table);
/***************************************************************************
@@ -1536,7 +1537,8 @@
table->field[0]->store(name_buffer, strlen(name_buffer),
system_charset_info);
table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(TRUE);
}
}
}
@@ -1592,6 +1594,33 @@
} INDEX_FIELD_VALUES;
+/*
+ Store record to I_S table, convert HEAP table
+ to MyISAM if necessary
+
+ SYNOPSIS
+ schema_table_store_record()
+ thd thread handler
+ table I_S table
+ RETURN
+ 1 error
+ 0 success
+*/
+
+static bool schema_table_store_record(THD *thd, TABLE *table)
+{
+ int error;
+ if ((error= table->file->write_row(table->record[0])))
+ {
+ if (create_myisam_from_heap(thd, table,
+ table->pos_in_table_list->schema_table_param,
+ error, 0))
+ return 1;
+ }
+ return 0;
+}
+
+
void get_index_field_values(LEX *lex, INDEX_FIELD_VALUES *index_field_values)
{
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
@@ -1915,7 +1944,8 @@
}
}
}
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(error);
}
else
{
@@ -1952,13 +1982,15 @@
}
-void store_schema_shemata(TABLE *table, const char *db_name,
+bool store_schema_shemata(THD* thd, TABLE *table, const char *db_name,
const char* cs_name)
{
restore_record(table, s->default_values);
table->field[1]->store(db_name, strlen(db_name), system_charset_info);
table->field[2]->store(cs_name, strlen(cs_name), system_charset_info);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
+ return 0;
}
@@ -1987,7 +2019,9 @@
{
if (with_i_schema) // information schema name is always first in list
{
- store_schema_shemata(table, file_name, system_charset_info->csname);
+ if (store_schema_shemata(thd, table, file_name,
+ system_charset_info->csname))
+ DBUG_RETURN(1);
with_i_schema= 0;
continue;
}
@@ -2010,8 +2044,9 @@
path[length-1]= FN_LIBCHAR;
strmov(path+length, MY_DB_OPT_FILE);
load_db_opt(thd, path, &create);
- store_schema_shemata(table, file_name,
- create.default_table_charset->csname);
+ if (store_schema_shemata(thd, table, file_name,
+ create.default_table_charset->csname))
+ DBUG_RETURN(1);
}
}
DBUG_RETURN(0);
@@ -2196,7 +2231,8 @@
}
}
}
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
@@ -2375,7 +2411,8 @@
#endif
table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
table->field[18]->store(field->comment.str, field->comment.length, cs);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
DBUG_RETURN(0);
@@ -2404,7 +2441,8 @@
strlen(tmp_cs->comment ? tmp_cs->comment : ""),
scs);
table->field[3]->store((longlong) tmp_cs->mbmaxlen);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
}
}
return 0;
@@ -2443,7 +2481,8 @@
tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
table->field[5]->store((longlong) tmp_cl->strxfrm_multiply);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
}
}
}
@@ -2472,14 +2511,15 @@
restore_record(table, s->default_values);
table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
}
}
return 0;
}
-void store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
+bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
const char *wild, bool full_access, const char *sp_user)
{
String tmp_string;
@@ -2493,7 +2533,7 @@
if (!full_access)
full_access= !strcmp(sp_user, definer);
if (!full_access && check_some_routine_access(thd, sp_db, sp_name))
- return;
+ return 0;
if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE ||
@@ -2542,9 +2582,11 @@
get_field(thd->mem_root, proc_table->field[15], &tmp_string);
table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs);
table->field[19]->store(definer, strlen(definer), cs);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
}
}
+ return 0;
}
@@ -2577,9 +2619,19 @@
res= (res == HA_ERR_END_OF_FILE) ? 0 : 1;
goto err;
}
- store_schema_proc(thd, table, proc_table, wild, full_access, definer);
+ if (store_schema_proc(thd, table, proc_table, wild, full_access, definer))
+ {
+ res= 1;
+ goto err;
+ }
while (!proc_table->file->index_next(proc_table->record[0]))
- store_schema_proc(thd, table, proc_table, wild, full_access, definer);
+ {
+ if (store_schema_proc(thd, table, proc_table, wild, full_access, definer))
+ {
+ res= 1;
+ goto err;
+ }
+ }
err:
proc_table->file->ha_index_end();
@@ -2669,7 +2721,8 @@
else
table->field[14]->store("", 0, cs);
table->field[14]->set_notnull();
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
}
@@ -2708,7 +2761,8 @@
table->field[5]->store("YES", 3, cs);
else
table->field[5]->store("NO", 2, cs);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
else
@@ -2722,9 +2776,9 @@
}
-void store_constraints(TABLE *table, const char*db, const char *tname,
- const char *key_name, uint key_len,
- const char *con_type, uint con_len)
+bool store_constraints(THD *thd, TABLE *table, const char *db,
+ const char *tname, const char *key_name,
+ uint key_len, const char *con_type, uint con_len)
{
CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values);
@@ -2733,7 +2787,9 @@
table->field[3]->store(db, strlen(db), cs);
table->field[4]->store(tname, strlen(tname), cs);
table->field[5]->store(con_type, con_len, cs);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ return 1;
+ return 0;
}
@@ -2766,11 +2822,17 @@
continue;
if (i == primary_key && !strcmp(key_info->name, primary_key_name))
- store_constraints(table, base_name, file_name, key_info->name,
- strlen(key_info->name), "PRIMARY KEY", 11);
+ {
+ if (store_constraints(thd, table, base_name, file_name, key_info->name,
+ strlen(key_info->name), "PRIMARY KEY", 11))
+ DBUG_RETURN(1);
+ }
else if (key_info->flags & HA_NOSAME)
- store_constraints(table, base_name, file_name, key_info->name,
- strlen(key_info->name), "UNIQUE", 6);
+ {
+ if (store_constraints(thd, table, base_name, file_name, key_info->name,
+ strlen(key_info->name), "UNIQUE", 6))
+ DBUG_RETURN(1);
+ }
}
show_table->file->get_foreign_key_list(thd, &f_key_list);
@@ -2778,8 +2840,11 @@
List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
while ((f_key_info=it++))
{
- store_constraints(table, base_name, file_name, f_key_info->forein_id->str,
- strlen(f_key_info->forein_id->str), "FOREIGN KEY", 11);
+ if (store_constraints(thd, table, base_name, file_name,
+ f_key_info->forein_id->str,
+ strlen(f_key_info->forein_id->str),
+ "FOREIGN KEY", 11))
+ DBUG_RETURN(1);
}
}
DBUG_RETURN(res);
@@ -2842,7 +2907,8 @@
key_part->field->field_name,
strlen(key_part->field->field_name),
(longlong) f_idx);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
}
@@ -2868,7 +2934,8 @@
(longlong) f_idx);
table->field[8]->store((longlong) f_idx);
table->field[8]->set_notnull();
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
}
@@ -2893,7 +2960,8 @@
table->field[1]->store(open_list->table, strlen(open_list->table), cs);
table->field[2]->store((longlong) open_list->in_use);
table->field[3]->store((longlong) open_list->locked);
- table->file->write_row(table->record[0]);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
@@ -3034,6 +3102,7 @@
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR, table_list->alias)))
DBUG_RETURN(0);
+ table_list->schema_table_param= tmp_table_param;
DBUG_RETURN(table);
}
--- 1.92/sql/table.h Sat Mar 19 03:12:22 2005
+++ 1.93/sql/table.h Thu Mar 24 16:32:04 2005
@@ -322,6 +322,7 @@
struct st_lex;
class select_union;
+class TMP_TABLE_PARAM;
struct Field_translator
{
@@ -370,6 +371,7 @@
ST_SCHEMA_TABLE *schema_table; /* Information_schema table */
st_select_lex *schema_select_lex;
bool schema_table_reformed;
+ TMP_TABLE_PARAM *schema_table_param;
/* link to select_lex where this table was used */
st_select_lex *select_lex;
st_lex *view; /* link on VIEW lex for merging */
--- 1.40/mysql-test/r/information_schema.result Tue Mar 22 16:48:00 2005
+++ 1.41/mysql-test/r/information_schema.result Thu Mar 24 16:32:04 2005
@@ -651,6 +651,8 @@
CREATE TABLE t_crashme ( f1 BIGINT);
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
+count(*)
+100
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
--- 1.28/mysql-test/t/information_schema.test Tue Mar 15 20:54:39 2005
+++ 1.29/mysql-test/t/information_schema.test Thu Mar 24 16:32:04 2005
@@ -403,6 +403,7 @@
--disable_result_log
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES;
--enable_result_log
+SELECT count(*) FROM INFORMATION_SCHEMA.TABLES;
let $tab_count= 65;
while ($tab_count)
{
| Thread |
|---|
| • bk commit into 5.0 tree (gluh:1.1847) BUG#9317 | gluh | 24 Mar |