Commit 9e1ead5a authored by unknown's avatar unknown

Fix for bug #7217: information_schema: columns are varbinary() instead of timestamp &

        bug #7215: information_schema: columns are longtext instead of varchar

parent 8f62bf27
......@@ -116,7 +116,7 @@ count(distinct n)
5000
show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 2
Created_tmp_disk_tables 1
drop table t1;
create table t1 (s text);
flush status;
......@@ -125,5 +125,5 @@ count(distinct s)
5000
show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 2
Created_tmp_disk_tables 1
drop table t1;
......@@ -494,8 +494,8 @@ select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE
SCHEMATA TEMPORARY MyISAM
TABLES TEMPORARY MyISAM
SCHEMATA TEMPORARY MEMORY
TABLES TEMPORARY MEMORY
show tables from information_schema like "T%";
Tables_in_information_schema (T%)
TABLES
......@@ -615,3 +615,19 @@ CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
drop view a2, a1;
drop table t_crashme;
select table_schema,table_name, column_name from
information_schema.columns
where data_type = 'longtext';
table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE
information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
information_schema VIEWS VIEW_DEFINITION
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
table_name column_name data_type
TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
ROUTINES CREATED datetime
ROUTINES LAST_ALTERED datetime
......@@ -94,6 +94,6 @@ d
2002-10-24 14:50:40
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 1
Created_tmp_disk_tables 0
Created_tmp_tables 2
drop table t1;
......@@ -390,3 +390,13 @@ while ($tab_count)
--enable_query_log
drop view a2, a1;
drop table t_crashme;
#
# Bug #7215 information_schema: columns are longtext instead of varchar
# Bug #7217 information_schema: columns are varbinary() instead of timestamp
#
select table_schema,table_name, column_name from
information_schema.columns
where data_type = 'longtext';
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
......@@ -1613,10 +1613,12 @@ class TMP_TABLE_PARAM :public Sql_alloc
/* If >0 convert all blob fields to varchar(convert_blob_length) */
uint convert_blob_length;
CHARSET_INFO *table_charset;
bool schema_table;
TMP_TABLE_PARAM()
:copy_field(0), group_parts(0),
group_length(0), group_null_parts(0), convert_blob_length(0)
group_length(0), group_null_parts(0), convert_blob_length(0),
schema_table(0)
{}
~TMP_TABLE_PARAM()
{
......
......@@ -7676,6 +7676,36 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
return new_field;
}
/*
Create field for information schema table
SYNOPSIS
create_tmp_field_for_schema()
thd Thread handler
table Temporary table
item Item to create a field for
RETURN
0 on error
new_created field
*/
Field *create_tmp_field_for_schema(THD *thd, Item *item, TABLE *table)
{
if (item->field_type() == MYSQL_TYPE_VARCHAR)
{
if (item->max_length > MAX_FIELD_VARCHARLENGTH /
item->collation.collation->mbmaxlen)
return new Field_blob(item->max_length, item->maybe_null,
item->name, table, item->collation.collation);
return new Field_varstring(item->max_length, item->maybe_null, item->name,
table, item->collation.collation);
}
return item->tmp_table_field_from_field_type(table);
}
/*
Create field for temporary table
......@@ -7978,10 +8008,13 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
We here distinguish between UNION and multi-table-updates by the fact
that in the later case group is set to the row pointer.
*/
Field *new_field= create_tmp_field(thd, table, item, type, &copy_func,
tmp_from_field, group != 0,
not_all_columns || group !=0,
param->convert_blob_length);
Field *new_field= (param->schema_table) ?
create_tmp_field_for_schema(thd, item, table) :
create_tmp_field(thd, table, item, type, &copy_func,
tmp_from_field, group != 0,
not_all_columns || group !=0,
param->convert_blob_length);
if (!new_field)
{
if (thd->is_fatal_error)
......
......@@ -3017,6 +3017,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
tmp_table_param->init();
tmp_table_param->table_charset= cs;
tmp_table_param->field_count= field_count;
tmp_table_param->schema_table= 1;
SELECT_LEX *select_lex= thd->lex->current_select;
if (!(table= create_tmp_table(thd, tmp_table_param,
field_list, (ORDER*) 0, 0, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment