From: Date: January 28 2006 10:50am Subject: bk commit into 5.0 tree (dlenev:1.2010) BUG#16829 List-Archive: http://lists.mysql.com/commits/1773 X-Bug: 16829 Message-Id: <20060128095032.C0A1B12F967@brandersnatch.site> Below is the list of changes that have just been committed into a local 5.0 repository of dlenev. When dlenev 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 1.2010 06/01/28 12:50:16 dlenev@stripped +3 -0 Fix for bug #16829 "Firing trigger with RETURN crashes the server" We should disallow usage of RETURN statement in triggers and emit error at parsing time (instead of crashing when trigger is fired). sql/sql_yacc.yy 1.450 06/01/28 12:50:09 dlenev@stripped +1 -1 We should disallow usage of RETURN statement in triggers and emit error at parsing time (instead of crashing when trigger is fired). mysql-test/t/trigger.test 1.33 06/01/28 12:50:08 dlenev@stripped +9 -0 Added test for bug #16829 "Firing trigger with RETURN crashes the server". mysql-test/r/trigger.result 1.28 06/01/28 12:50:08 dlenev@stripped +5 -0 Added test for bug #16829 "Firing trigger with RETURN crashes the server". # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: dlenev # Host: brandersnatch.site # Root: /home/dlenev/src/mysql-5.0-bg16829 --- 1.449/sql/sql_yacc.yy 2006-01-24 20:15:09 +03:00 +++ 1.450/sql/sql_yacc.yy 2006-01-28 12:50:09 +03:00 @@ -1981,7 +1981,7 @@ LEX *lex= Lex; sp_head *sp= lex->sphead; - if (sp->m_type == TYPE_ENUM_PROCEDURE) + if (sp->m_type != TYPE_ENUM_FUNCTION) { my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0)); YYABORT; --- 1.27/mysql-test/r/trigger.result 2006-01-12 03:02:48 +03:00 +++ 1.28/mysql-test/r/trigger.result 2006-01-28 12:50:08 +03:00 @@ -785,3 +785,8 @@ ERROR 3D000: No database selected drop trigger t1_bi; ERROR 3D000: No database selected +create table t1 (i int); +create trigger t1_bi before insert on t1 for each row return 0; +ERROR 42000: RETURN is only allowed in a FUNCTION +insert into t1 values (1); +drop table t1; --- 1.32/mysql-test/t/trigger.test 2006-01-06 01:49:22 +03:00 +++ 1.33/mysql-test/t/trigger.test 2006-01-28 12:50:08 +03:00 @@ -958,3 +958,12 @@ --error ER_NO_DB_ERROR drop trigger t1_bi; connection default; + +# Test for bug #16829 "Firing trigger with RETURN crashes the server" +# RETURN is not supposed to be used anywhere except functions, so error +# should be returned when one attempts to create trigger with RETURN. +create table t1 (i int); +--error ER_SP_BADRETURN +create trigger t1_bi before insert on t1 for each row return 0; +insert into t1 values (1); +drop table t1;