diff options
author | unknown <evgen@moonbone.local> | 2005-08-10 17:45:00 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-08-10 17:45:00 +0400 |
commit | e66cd71698e033c788adb6364fdf261143fb5601 (patch) | |
tree | 9daa110455c864e4bfbf2f5a8c350de43a71686e /sql/sql_derived.cc | |
parent | aa337b1d5e0de234458b15d4eeead1ff5df45822 (diff) | |
download | mariadb-git-e66cd71698e033c788adb6364fdf261143fb5601.tar.gz |
Fix bug #11864 non unique names are allowed in subquery
Column names weren't checked for uniqueness for subqueries.
Code for names uniqueness checking used for view creation moved into
separate function named check_duplicate_names(). It's called on
preparation of subqueries to check uniqueness of names. If duplicate names
are found then error is raised.
sql/sql_derived.cc:
Fix bug #11864 non unique names are allowed in subquery
Added check for names uniqueness in select list.
sql/sql_view.cc:
Fix bug #11864 non unique names are allowed in subquery
Code for checking uniqueness of names in item list moved into separate function to make in available for use from other places.
sql/sql_view.h:
Fix bug #11864 non unique names are allowed in subquery
Added check_duplicate_names() function prototype.
mysql-test/t/derived.test:
Fixed test case results after bug fix #11864
Added test case for bug#11864 non unique names are allowed in subquery.
mysql-test/t/select_safe.test:
Fixed test case results after bug fix #11864
mysql-test/r/derived.result:
Added test case for bug #11864 non unique names are allowed in subquery.
Fixed test case results after bug fix #11864
mysql-test/r/select_safe.result:
Fixed test case results after bug fix #11864
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index fc9d15e94c4..7b9191cd841 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -125,6 +125,11 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list) if ((res= unit->prepare(thd, derived_result, 0, orig_table_list->alias))) goto exit; + if (check_duplicate_names(unit->types, 0)) + { + res= -1; + goto exit; + } derived_result->tmp_table_param.init(); derived_result->tmp_table_param.field_count= unit->types.elements; |