Hi Martin
mhansson@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 5.0 repository of martin. When martin does a push these changes will
> be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2007-08-24 15:40:16+02:00, mhansson@stripped +4 -0
> Bug #30234: Unexpected behavior using DELETE with AS and USING
>
> DELETE FROM ... USING ... statements with the following type of
> ambiguous aliasing gave unexpected results:
> DELETE FROM t1 AS alias USING t1, t2 AS alias WHERE t1.a = alias.a;
> This query would leave table t1 intact but delete rows from t2.
> Fixed by changing DELETE FROM ... USING syntax so that only alias
> references (as opposed to alias declarations) may be used in FROM.
>
> BitKeeper/etc/ignore@stripped, 2007-08-24 15:40:14+02:00, mhansson@stripped +5
> -0
> Added support-files/mysqld_multi.server tests/bug25714 cscope.in.out cscope.out
> cscope.po.out to the ignore list
>
> mysql-test/r/delete.result@stripped, 2007-08-24 15:40:14+02:00,
> mhansson@stripped +37 -0
> Bug#30234: Test Result
>
> mysql-test/t/delete.test@stripped, 2007-08-24 15:40:14+02:00, mhansson@stripped
> +44 -0
> Bug#30234: Test Case
>
> sql/sql_yacc.yy@stripped, 2007-08-24 15:40:14+02:00, mhansson@stripped +17 -2
> Bug#30234:
> - Added parser rule table_alias_ref_list that contains a list of table
> aliases only.
> - Added parser rule table_alias_ref that sets the TL_OPTION_ALIAS in
> order to turn off semantic checking that applies only for table names.
>
>
(...)
> diff -Nrup a/sql/sql_yacc.yy b/sql/sql_yacc.yy
> --- a/sql/sql_yacc.yy 2007-07-30 01:33:07 +02:00
> +++ b/sql/sql_yacc.yy 2007-08-24 15:40:14 +02:00
> @@ -1159,7 +1159,8 @@ bool my_yyoverflow(short **a, YYSTYPE **
> field_opt_list opt_binary table_lock_list table_lock
> ref_list opt_on_delete opt_on_delete_list opt_on_delete_item use
> opt_delete_options opt_delete_option varchar nchar nvarchar
> - opt_outer table_list table_name opt_option opt_place
> + opt_outer table_list table_name table_alias_ref_list table_alias_ref
> + opt_option opt_place
> opt_attribute opt_attribute_list attribute column_list column_list_id
> opt_column_list grant_privileges grant_ident grant_list grant_option
> object_privilege object_privilege_list user_list rename_list
> @@ -6504,6 +6505,20 @@ table_name:
> }
> ;
>
> +table_alias_ref_list:
> + table_alias_ref
> + | table_alias_ref_list ',' table_alias_ref;
> +
>
Left recursive, ok.
> +table_alias_ref:
> + table_ident
> + {
> + if (!Select->add_table_to_list(YYTHD, $1, NULL,
> + TL_OPTION_UPDATING | TL_OPTION_ALIAS,
> + Lex->lock_option ))
> + MYSQL_YYABORT;
> + }
> + ;
>
Ok
> +
> if_exists:
> /* empty */ { $$= 0; }
> | IF EXISTS { $$= 1; }
> @@ -6774,7 +6789,7 @@ single_multi:
> if (multi_delete_set_locks_and_link_aux_tables(Lex))
> MYSQL_YYABORT;
> }
> - | FROM table_wild_list
> + | FROM table_alias_ref_list
>
Ok.
Verified by analysis of the grammar that this change impact only the
following syntax :
DELETE ... FROM ... USING
Other statements using table aliases are not affected.
> { mysql_init_multi_delete(Lex); }
> USING join_table_list where_clause
> {
>
>
Ok to push
Thanks,
Marc