Commit ea140d86 authored by Georgi Kodinov's avatar Georgi Kodinov

merge

parents 2ecadfc1 3e1a4707
...@@ -148,3 +148,20 @@ a ...@@ -148,3 +148,20 @@ a
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
End of 5.0 tests. End of 5.0 tests.
#
# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
# returns nothing
#
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
count(COLUMN_NAME)
1
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
count(*)
1
DROP TABLE `ttt`;
End of 5.0 tests.
...@@ -160,4 +160,26 @@ SELECT * FROM v1; ...@@ -160,4 +160,26 @@ SELECT * FROM v1;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.0 tests.
--echo #
--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
--echo # returns nothing
--echo #
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
DROP TABLE `ttt`;
--echo End of 5.0 tests. --echo End of 5.0 tests.
...@@ -2626,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables, ...@@ -2626,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS; const char *wild= lex->wild ? lex->wild->ptr() : NullS;
bool rc= 0;
bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES)); bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
switch (lex->sql_command) { switch (lex->sql_command) {
case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_DATABASES:
if (wild) if (wild)
{ {
lookup_field_values->db_value.str= (char*) wild; thd->make_lex_string(&lookup_field_values->db_value,
lookup_field_values->db_value.length= strlen(wild); wild, strlen(wild), 0);
lookup_field_values->wild_db_value= 1; lookup_field_values->wild_db_value= 1;
} }
return 0; break;
case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS: case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS: case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_EVENTS: case SQLCOM_SHOW_EVENTS:
lookup_field_values->db_value.str= lex->select_lex.db; thd->make_lex_string(&lookup_field_values->db_value,
lookup_field_values->db_value.length=strlen(lex->select_lex.db); lex->select_lex.db, strlen(lex->select_lex.db), 0);
if (wild) if (wild)
{ {
lookup_field_values->table_value.str= (char*)wild; thd->make_lex_string(&lookup_field_values->table_value,
lookup_field_values->table_value.length= strlen(wild); wild, strlen(wild), 0);
lookup_field_values->wild_table_value= 1; lookup_field_values->wild_table_value= 1;
} }
return 0; break;
default: default:
/* /*
The "default" is for queries over I_S. The "default" is for queries over I_S.
All previous cases handle SHOW commands. All previous cases handle SHOW commands.
*/ */
return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values); rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
break;
} }
if (lower_case_table_names && !rc)
{
/*
We can safely do in-place upgrades here since all of the above cases
are allocating a new memory buffer for these strings.
*/
if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0])
my_casedn_str(system_charset_info, lookup_field_values->db_value.str);
if (lookup_field_values->table_value.str &&
lookup_field_values->table_value.str[0])
my_casedn_str(system_charset_info, lookup_field_values->table_value.str);
}
return rc;
} }
...@@ -3441,6 +3459,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -3441,6 +3459,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
error= 0; error= 0;
goto err; goto err;
} }
DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
STR_OR_NIL(lookup_field_vals.db_value.str), STR_OR_NIL(lookup_field_vals.db_value.str),
STR_OR_NIL(lookup_field_vals.table_value.str))); STR_OR_NIL(lookup_field_vals.table_value.str)));
......
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