diff options
author | unknown <mhansson/martin@linux-st28.site> | 2007-12-15 12:07:33 +0100 |
---|---|---|
committer | unknown <mhansson/martin@linux-st28.site> | 2007-12-15 12:07:33 +0100 |
commit | 30b17b997fa7a096b2644a3260cf1106e69f1ccc (patch) | |
tree | ea4a2f8d8db958da25a0c5f8c16d98b39096cdd0 /sql/sql_yacc.yy | |
parent | d8babe1ae29065af5fa1c11f16e8db52c280e5ca (diff) | |
parent | 93e3057ba574672c2f0bb1b0958221c0d7efc553 (diff) | |
download | mariadb-git-30b17b997fa7a096b2644a3260cf1106e69f1ccc.tar.gz |
Merge mhansson@bk-internal:/home/bk/mysql-5.0-opt
into linux-st28.site:/home/martin/mysql/src/bug32858/my50-bug32858-push
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/union.result:
Bug#32858: Manual merge
mysql-test/t/union.test:
Bug#32858: Manual merge
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 170ae1b889b..c4aca1df7ec 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6350,7 +6350,8 @@ procedure_item: select_var_list_init: { LEX *lex=Lex; - if (!lex->describe && (!(lex->result= new select_dumpvar()))) + if (!lex->describe && + (!(lex->result= new select_dumpvar(lex->nest_level)))) MYSQL_YYABORT; } select_var_list @@ -6424,7 +6425,7 @@ into_destination: LEX *lex= Lex; lex->uncacheable(UNCACHEABLE_SIDEEFFECT); if (!(lex->exchange= new sql_exchange($2.str, 0)) || - !(lex->result= new select_export(lex->exchange))) + !(lex->result= new select_export(lex->exchange, lex->nest_level))) MYSQL_YYABORT; } opt_field_term opt_line_term @@ -6436,7 +6437,7 @@ into_destination: lex->uncacheable(UNCACHEABLE_SIDEEFFECT); if (!(lex->exchange= new sql_exchange($2.str,1))) MYSQL_YYABORT; - if (!(lex->result= new select_dump(lex->exchange))) + if (!(lex->result= new select_dump(lex->exchange, lex->nest_level))) MYSQL_YYABORT; } } @@ -9427,12 +9428,18 @@ union_list: UNION_SYM union_option { LEX *lex=Lex; - if (lex->result) - { - /* Only the last SELECT can have INTO...... */ - my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO"); - MYSQL_YYABORT; - } + if (lex->result && + (lex->result->get_nest_level() == -1 || + lex->result->get_nest_level() == lex->nest_level)) + { + /* + Only the last SELECT can have INTO unless the INTO and UNION + are at different nest levels. In version 5.1 and above, INTO + will onle be allowed at top level. + */ + my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO"); + MYSQL_YYABORT; + } if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) { my_parse_error(ER(ER_SYNTAX_ERROR)); |