diff options
author | unknown <bell@sanja.is.com.ua> | 2003-07-25 01:02:42 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-07-25 01:02:42 +0300 |
commit | 7ec21e9fc4d2311a421f3a4a9c726e394327910b (patch) | |
tree | b372f15a0e7c30b372d003889c793e1e49b97f22 | |
parent | d35bf560bedd73803c2340d44704b173b2bead3c (diff) | |
download | mariadb-git-7ec21e9fc4d2311a421f3a4a9c726e394327910b.tar.gz |
added warning about external fields resolving to EXPLAIN command
(SCRUM) (WL#1053)
include/mysqld_error.h:
new warning
mysql-test/r/subselect.result:
new warning
sql/item.cc:
warning for external fields resolving
sql/share/czech/errmsg.txt:
new warning
sql/share/danish/errmsg.txt:
new warning
sql/share/dutch/errmsg.txt:
new warning
sql/share/english/errmsg.txt:
new warning
sql/share/estonian/errmsg.txt:
new warning
sql/share/french/errmsg.txt:
new warning
sql/share/german/errmsg.txt:
new warning
sql/share/greek/errmsg.txt:
new warning
sql/share/hungarian/errmsg.txt:
new warning
sql/share/italian/errmsg.txt:
new warning
sql/share/japanese/errmsg.txt:
new warning
sql/share/korean/errmsg.txt:
new warning
sql/share/norwegian-ny/errmsg.txt:
new warning
sql/share/norwegian/errmsg.txt:
new warning
sql/share/polish/errmsg.txt:
new warning
sql/share/portuguese/errmsg.txt:
new warning
sql/share/romanian/errmsg.txt:
new warning
sql/share/russian/errmsg.txt:
new warning
sql/share/serbian/errmsg.txt:
new warning
sql/share/slovak/errmsg.txt:
new warning
sql/share/spanish/errmsg.txt:
new warning
sql/share/swedish/errmsg.txt:
new warning
sql/share/ukrainian/errmsg.txt:
new warning
26 files changed, 55 insertions, 7 deletions
diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 0468663239b..b8a90c31a68 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -287,4 +287,5 @@ #define ER_CANT_AGGREGATE_3COLLATIONS 1268 #define ER_CANT_AGGREGATE_NCOLLATIONS 1269 #define ER_VARIABLE_IS_NOT_STRUCT 1270 -#define ER_ERROR_MESSAGES 271 +#define ER_WARN_FIELD_RESOLVED 1271 +#define ER_ERROR_MESSAGES 272 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index e941c115b2c..dea79868dac 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -42,6 +42,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> system NULL NULL NULL NULL 1 3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1271 Field or reference 'a' of SELECT #3 was resolved in SELECT #1 +Note 1271 Field or reference '.a' of SELECT #3 was resolved in SELECT #1 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; 1 1 @@ -207,6 +210,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where +Warnings: +Note 1271 Field or reference 't4.a' of SELECT #3 was resolved in SELECT #1 select * from t3 where exists (select * from t2 where t2.b=t3.a); a 7 @@ -286,6 +291,9 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 Using where +Warnings: +Note 1271 Field or reference 't2.a' of SELECT #2 was resolved in SELECT #1 +Note 1271 Field or reference 't2.a' of SELECT #3 was resolved in SELECT #1 select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; ERROR 21000: Subselect returns more than 1 record create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); @@ -301,6 +309,8 @@ explain select * from t6 where exists (select * from t7 where uq = clinic_uq); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t6 ALL NULL NULL NULL NULL 4 Using where 2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 +Warnings: +Note 1271 Field or reference 'clinic_uq' of SELECT #2 was resolved in SELECT #1 select * from t1 where a= (select a from t2,t4 where t2.b=t4.b); ERROR 23000: Column: 'a' in field list is ambiguous drop table if exists t1,t2,t3; @@ -808,6 +818,7 @@ explain select (select a+1) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Warnings: +Note 1271 Field or reference 'a' of SELECT #2 was resolved in SELECT #1 Note 1247 Select 2 was reduced during optimisation select (select a+1) from t1; (select a+1) diff --git a/sql/item.cc b/sql/item.cc index c7d0927c970..57769d40fed 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -23,7 +23,8 @@ #include <m_ctype.h> #include "my_dir.h" -static void mark_as_dependent(SELECT_LEX *last, SELECT_LEX *current, +static void mark_as_dependent(THD *thd, + SELECT_LEX *last, SELECT_LEX *current, Item_ident *item); /***************************************************************************** @@ -810,17 +811,29 @@ bool Item_ref_null_helper::get_date(TIME *ltime, bool fuzzydate) SYNOPSIS mark_as_dependent() + thd - thread handler last - select from which current item depend current - current select item - item which should be marked */ -static void mark_as_dependent(SELECT_LEX *last, SELECT_LEX *current, +static void mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current, Item_ident *item) { // store pointer on SELECT_LEX from wich item is dependent item->depended_from= last; current->mark_as_dependent(last); + if (thd->lex.describe) + { + char warn_buff[MYSQL_ERRMSG_SIZE]; + sprintf(warn_buff, ER(ER_WARN_FIELD_RESOLVED), + (item->db_name?item->db_name:""), (item->db_name?".":""), + (item->table_name?item->table_name:""), (item->table_name?".":""), + item->field_name, + current->select_number, last->select_number); + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_WARN_FIELD_RESOLVED, warn_buff); + } } @@ -902,12 +915,12 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if (rf->fix_fields(thd, tables, ref) || rf->check_cols(1)) return 1; - mark_as_dependent(last, cursel, rf); + mark_as_dependent(thd, last, cursel, rf); return 0; } else { - mark_as_dependent(last, cursel, this); + mark_as_dependent(thd, last, cursel, this); if (last->having_fix_field) { Item_ref *rf; @@ -1379,7 +1392,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) Item_field* fld; if (!((*reference)= fld= new Item_field(tmp))) return 1; - mark_as_dependent(last, thd->lex.current_select, fld); + mark_as_dependent(thd, last, thd->lex.current_select, fld); return 0; } else @@ -1390,7 +1403,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference) "forward reference in item list"); return -1; } - mark_as_dependent(last, thd->lex.current_select, + mark_as_dependent(thd, last, thd->lex.current_select, this); ref= last->ref_pointer_array + counter; } diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 6f42243ba2b..b47258fd07b 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -276,3 +276,4 @@ v/* "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 25a5020a30f..56b36b98c30 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -270,3 +270,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 6aba93c246c..80d931b4ab7 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -278,3 +278,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 11ae2c89019..66052ff6c9a 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 94e19fc6e9d..0d13c6fe237 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index dd062cc074a..8616f0ed485 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index e7cdf3f6f0d..1850dd5e95f 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -276,3 +276,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index ef423ae2758..d1a69677c81 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 6b27cdc2551..dd1c6c6eba7 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 8b0598f64b5..69b605e2185 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 011d6a1faac..10e295894e6 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index be7fee7cb45..37182e3514c 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 96c11871502..faae05934ba 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index c505d512e9e..f131ab0baef 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 33b2fbdb8a8..a3759da317b 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -271,3 +271,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index e8a3205ec5d..b3833b3583b 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 6602b5d430c..1ba2ac8ec49 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -271,3 +271,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index 70ff979bfdf..17ea1dfcf6e 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -269,3 +269,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"ðÏÌÅ ÉÌÉ ÓÓÙÌËÁ '%-.64s%s%-.64s%s%-.64s' ÉÚ SELECTÁ #%d ÂÙÌÁ ÎÁÊÄÅÎÁ × SELECTÅ #%d", diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index f4ea3ac3c82..8e9512f5567 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -263,3 +263,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 2ba4f2f0548..f49ff1a2adc 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -275,3 +275,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index c7f8d51dee9..9f3aa3dd478 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -268,3 +268,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 0d51cb4b543..ab2cc1f66b0 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -267,3 +267,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 4e22dbfcf3e..bfa1d0db9e4 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -272,3 +272,4 @@ "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations for operation '%s'", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", +"óÔÏ×ÂÅÃØ ÁÂÏ ÐÏÓÉÌÁÎÎÑ '%-.64s%s%-.64s%s%-.64s' ¦Ú SELECTÕ #%d ÂÕÌÏ ÚÎÁÊÄÅÎÅ Õ SELECT¦ #%d", |