diff options
author | unknown <gluh@gluh.mysql.r18.ru> | 2004-12-16 17:33:21 +0300 |
---|---|---|
committer | unknown <gluh@gluh.mysql.r18.ru> | 2004-12-16 17:33:21 +0300 |
commit | 8c5a5c32c535486555d60c8d1e9dd41fdc2f8b78 (patch) | |
tree | c1f87c0a24ba977503fc843374da4dbdb84f2ca9 /sql | |
parent | 22ae0abb1e47299d13c6535904e22a5ca5e39a85 (diff) | |
parent | db849cf55810f342d9c704c6a378787f27e5cc15 (diff) | |
download | mariadb-git-8c5a5c32c535486555d60c8d1e9dd41fdc2f8b78.tar.gz |
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0
into gluh.mysql.r18.ru:/home/gluh/MySQL/mysql-5.0.n
Diffstat (limited to 'sql')
-rw-r--r-- | sql/share/errmsg.txt | 2 | ||||
-rw-r--r-- | sql/sql_derived.cc | 12 | ||||
-rw-r--r-- | sql/sql_show.cc | 54 | ||||
-rw-r--r-- | sql/table.cc | 5 |
4 files changed, 65 insertions, 8 deletions
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 714b18b39f2..6908135b577 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5464,7 +5464,7 @@ ER_WARN_VIEW_WITHOUT_KEY serbian "View '%-.64s.%-.64s' references invalid table(s) or column(s)" ukr "View, що оновлюеться, не м╕стить повного ключа таблиц╕(ь), що викор╕стана в ньюому" ER_VIEW_INVALID - eng "View '%-.64s.%-.64s' references invalid table(s) or column(s)" + eng "View '%-.64s.%-.64s' references invalid table(s) or column(s) or function(s)" rus "View '%-.64s.%-.64s' ссылается на несуществующие таблицы или столбцы" serbian "Can't drop a %s from within another stored routine" ukr "View '%-.64s.%-.64s' посила╓тся на не╕снуюч╕ таблиц╕ або стовбц╕" diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 69511018880..7cea1c6fcee 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -140,6 +140,18 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list) derived_result->set_table(table); exit: + /* Hide "Unknown column" or "Unknown function" error */ + if (orig_table_list->view) + { + if (thd->net.last_errno == ER_BAD_FIELD_ERROR || + thd->net.last_errno == ER_SP_DOES_NOT_EXIST) + { + thd->clear_error(); + my_error(ER_VIEW_INVALID, MYF(0), orig_table_list->db, + orig_table_list->real_name); + } + } + /* if it is preparation PS only or commands that need only VIEW structure then we do not need real data and we can skip execution (and parameters diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e50c68dd289..81903df8dc7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2374,12 +2374,24 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, const char *file_name) { TIME time; - const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; + LEX *lex= thd->lex; + const char *wild= lex->wild ? lex->wild->ptr() : NullS; CHARSET_INFO *cs= system_charset_info; DBUG_ENTER("get_schema_column_record"); if (res) { - DBUG_RETURN(1); + if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS) + { + /* + I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS + rather than in SHOW COLUMNS + */ + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + thd->net.last_errno, thd->net.last_error); + thd->clear_error(); + res= 0; + } + DBUG_RETURN(res); } TABLE *show_table= tables->table; @@ -2745,7 +2757,23 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables, { CHARSET_INFO *cs= system_charset_info; DBUG_ENTER("get_schema_stat_record"); - if (!res && !tables->view) + if (res) + { + if (thd->lex->orig_sql_command != SQLCOM_SHOW_KEYS) + { + /* + I.e. we are in SELECT FROM INFORMATION_SCHEMA.STATISTICS + rather than in SHOW KEYS + */ + if (!tables->view) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + thd->net.last_errno, thd->net.last_error); + thd->clear_error(); + res= 0; + } + DBUG_RETURN(res); + } + else if (!tables->view) { TABLE *show_table= tables->table; KEY *key_info=show_table->key_info; @@ -2868,7 +2896,15 @@ static int get_schema_constraints_record(THD *thd, struct st_table_list *tables, const char *file_name) { DBUG_ENTER("get_schema_constraints_record"); - if (!res && !tables->view) + if (res) + { + if (!tables->view) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + thd->net.last_errno, thd->net.last_error); + thd->clear_error(); + DBUG_RETURN(0); + } + else if (!tables->view) { List<FOREIGN_KEY_INFO> f_key_list; TABLE *show_table= tables->table; @@ -2925,7 +2961,15 @@ static int get_schema_key_column_usage_record(THD *thd, { DBUG_ENTER("get_schema_key_column_usage_record"); CHARSET_INFO *cs= system_charset_info; - if (!res && !tables->view) + if (res) + { + if (!tables->view) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + thd->net.last_errno, thd->net.last_error); + thd->clear_error(); + DBUG_RETURN(0); + } + else if (!tables->view) { List<FOREIGN_KEY_INFO> f_key_list; TABLE *show_table= tables->table; diff --git a/sql/table.cc b/sql/table.cc index b4a07448b14..b54cc351dff 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1845,8 +1845,9 @@ ok: DBUG_RETURN(0); err: - /* Hide "Unknown column" error */ - if (thd->net.last_errno == ER_BAD_FIELD_ERROR) + /* Hide "Unknown column" or "Unknown function" error */ + if (thd->net.last_errno == ER_BAD_FIELD_ERROR || + thd->net.last_errno == ER_SP_DOES_NOT_EXIST) { thd->clear_error(); my_error(ER_VIEW_INVALID, MYF(0), view_db.str, view_name.str); |