From: Date: May 13 2006 8:56pm Subject: bk commit into 5.0 tree (igor:1.2136) BUG#19396 List-Archive: http://lists.mysql.com/commits/6342 X-Bug: 19396 Message-Id: <20060513185615.2B1C42C8CBB@rurik.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of igor. When igor 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.2136 06/05/13 11:56:05 igor@stripped +3 -0 Fixed bug #19396: a crash for a an outer join operation over two views when using syntax with curly braces. Each outer join operation must be placed in a separate nest. This was not done when the syntax with curly braces was used. In some cases, in particular, for queries with outer join operation over views it could cause a crash. sql/sql_yacc.yy 1.467 06/05/13 11:55:59 igor@stripped +4 -0 Fixed bug #19396: a crash for a an outer join operation over two views when using syntax with curly braces. Each outer join operation must be placed in a separate nest. This was not done when the syntax with curly braces was used. In some cases, in particular, for queries with outer join operation over views it could cause a crash. mysql-test/t/join_outer.test 1.36 06/05/13 11:55:59 igor@stripped +26 -0 Added a test case for bug #19396. mysql-test/r/join_outer.result 1.47 06/05/13 11:55:58 igor@stripped +22 -0 Added a test case for bug #19396. # 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: igor # Host: rurik.mysql.com # Root: /home/igor/dev/mysql-5.0-2 --- 1.466/sql/sql_yacc.yy 2006-04-22 21:11:24 -07:00 +++ 1.467/sql/sql_yacc.yy 2006-05-13 11:55:59 -07:00 @@ -448,6 +448,7 @@ %token NUMERIC_SYM %token NVARCHAR_SYM %token OFFSET_SYM +%token OJ_SYM %token OLD_PASSWORD %token ON %token ONE_SHOT_SYM @@ -5246,11 +5247,14 @@ } expr '}' { + LEX *lex= Lex; YYERROR_UNLESS($3 && $7); add_join_on($7,$10); Lex->pop_context(); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; + if (!($$= lex->current_select->nest_last_join(lex->thd))) + YYABORT; } | select_derived_init get_select_lex select_derived2 { --- 1.46/mysql-test/r/join_outer.result 2006-03-24 12:44:48 -08:00 +++ 1.47/mysql-test/r/join_outer.result 2006-05-13 11:55:58 -07:00 @@ -1154,3 +1154,25 @@ 1 SIMPLE t1 index PRIMARY,name name 23 NULL 3 Using where; Using index 1 SIMPLE t2 ref fkey fkey 5 test.t1.id 1 Using where; Using index DROP TABLE t1,t2; +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2; +CREATE TABLE t1 (a int); +CREATE table t2 (b int); +INSERT INTO t1 VALUES (1), (2), (3), (4), (1), (1), (3); +INSERT INTO t2 VALUES (2), (3); +CREATE VIEW v1 AS SELECT a FROM t1 JOIN t2 ON t1.a=t2.b; +CREATE VIEW v2 AS SELECT b FROM t2 JOIN t1 ON t2.b=t1.a; +SELECT v1.a, v2. b +FROM v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3) +GROUP BY v1.a; +a b +2 NULL +3 3 +SELECT v1.a, v2. b +FROM { OJ v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3) } +GROUP BY v1.a; +a b +2 NULL +3 3 +DROP VIEW v1,v2; +DROP TABLE t1,t2; --- 1.35/mysql-test/t/join_outer.test 2006-03-24 12:44:48 -08:00 +++ 1.36/mysql-test/t/join_outer.test 2006-05-13 11:55:59 -07:00 @@ -779,3 +779,29 @@ WHERE t1.name LIKE 'A%' OR FALSE; DROP TABLE t1,t2; + +# +# Bug 19396: LEFT OUTER JOIN over views in curly braces +# +--disable_warnings +DROP VIEW IF EXISTS v1,v2; +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +CREATE TABLE t1 (a int); +CREATE table t2 (b int); +INSERT INTO t1 VALUES (1), (2), (3), (4), (1), (1), (3); +INSERT INTO t2 VALUES (2), (3); + +CREATE VIEW v1 AS SELECT a FROM t1 JOIN t2 ON t1.a=t2.b; +CREATE VIEW v2 AS SELECT b FROM t2 JOIN t1 ON t2.b=t1.a; + +SELECT v1.a, v2. b + FROM v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3) + GROUP BY v1.a; +SELECT v1.a, v2. b + FROM { OJ v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3) } + GROUP BY v1.a; + +DROP VIEW v1,v2; +DROP TABLE t1,t2;