diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 3580a7f4f18..1237bae9d71 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -252,6 +252,11 @@ begin select * from t1; select * from t2; end| +select parameter_style, sql_data_access, dtd_identifier +from information_schema.routines; +parameter_style sql_data_access dtd_identifier +SQL CONTAINS SQL NULL +SQL CONTAINS SQL int show procedure status; Db Name Type Definer Modified Created Security_type Comment test sel2 PROCEDURE root@localhost # # DEFINER diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 123967f1c4a..b909e8b8e53 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -92,6 +92,12 @@ begin end| delimiter ;| +# +# Bug#7222 information_schema: errors in "routines" +# +select parameter_style, sql_data_access, dtd_identifier +from information_schema.routines; + --replace_column 5 # 6 # show procedure status; --replace_column 5 # 6 # diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 383b16cca18..421669c3121 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2661,20 +2661,25 @@ void store_schema_proc(THD *thd, TABLE *table, tmp_string.length(0); get_field(thd->mem_root, proc_table->field[2], &tmp_string); table->field[4]->store(tmp_string.ptr(), tmp_string.length(), cs); - tmp_string.length(0); - get_field(thd->mem_root, proc_table->field[9], &tmp_string); - table->field[5]->store(tmp_string.ptr(), tmp_string.length(), cs); + if (proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) + { + tmp_string.length(0); + get_field(thd->mem_root, proc_table->field[9], &tmp_string); + table->field[5]->store(tmp_string.ptr(), tmp_string.length(), cs); + table->field[5]->set_notnull(); + } table->field[6]->store("SQL", 3, cs); tmp_string.length(0); get_field(thd->mem_root, proc_table->field[10], &tmp_string); table->field[7]->store(tmp_string.ptr(), tmp_string.length(), cs); - table->field[8]->store("SQL", 3, cs); + table->field[10]->store("SQL", 3, cs); tmp_string.length(0); get_field(thd->mem_root, proc_table->field[6], &tmp_string); table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs); - tmp_string.length(0); - get_field(thd->mem_root, proc_table->field[5], &tmp_string); - table->field[12]->store(tmp_string.ptr(), tmp_string.length(), cs); + if (proc_table->field[5]->val_int() == SP_CONTAINS_SQL) + { + table->field[12]->store("CONTAINS SQL", 12 , cs); + } tmp_string.length(0); get_field(thd->mem_root, proc_table->field[7], &tmp_string); table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs); @@ -3476,12 +3481,12 @@ ST_FIELD_INFO proc_fields_info[]= {"ROUTINE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db"}, {"ROUTINE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"}, {"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"}, - {"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, - {"ROUTINE_BODY", 3, MYSQL_TYPE_STRING, 0, 0, 0}, + {"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0}, + {"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0}, {"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0}, {"EXTERNAL_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0}, {"EXTERNAL_LANGUAGE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0}, - {"PARAMETER_STYLE", 3, MYSQL_TYPE_STRING, 0, 0, 0}, + {"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0}, {"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0}, {"SQL_DATA_ACCESS", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, {"SQL_PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},