From: konstantin Date: December 2 2005 7:44pm Subject: bk commit into 5.0 tree (konstantin:1.2046) BUG#5967 List-Archive: http://lists.mysql.com/internals/32978 X-Bug: 5967 Message-Id: <20051202194416.D62227336@dragonfly.local> Below is the list of changes that have just been committed into a local 5.0 repository of kostja. When kostja 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.2046 05/12/02 22:43:56 konstantin@stripped +2 -0 Add a test case for Bug#5967 "Stored procedure declared variable used instead of column", the bug is to be fixed later. mysql-test/t/sp.test 1.164 05/12/02 22:43:46 konstantin@stripped +45 -0 Add a test case for Bug#5967 "Stored procedure declared variable used instead of column", the bug is to be fixed later. mysql-test/r/sp.result 1.171 05/12/02 22:43:46 konstantin@stripped +54 -0 Test results were fixed (Bug#5967) # 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: konstantin # Host: dragonfly.local # Root: /opt/local/work/mysql-5.0-root --- 1.170/mysql-test/r/sp.result 2005-12-02 17:04:43 +03:00 +++ 1.171/mysql-test/r/sp.result 2005-12-02 22:43:46 +03:00 @@ -4099,4 +4099,58 @@ x 4711 drop procedure bug14376| +drop procedure if exists p1| +Warnings: +Note 1305 PROCEDURE p1 does not exist +drop table if exists t1| +create table t1 (a varchar(255))| +insert into t1 (a) values ("a - table column")| +create procedure p1(a varchar(255)) +begin +declare i varchar(255); +declare c cursor for select a from t1; +select a; +select a from t1 into i; +select i as 'Parameter takes precedence over table column'; open c; +fetch c into i; +close c; +select i as 'Parameter takes precedence over table column in cursors'; +begin +declare a varchar(255) default 'a - local variable'; +declare c1 cursor for select a from t1; +select a as 'A local variable takes precedence over parameter'; +open c1; +fetch c1 into i; +close c1; +select i as 'A local variable takes precedence over parameter in cursors'; +begin +declare a varchar(255) default 'a - local variable in a nested compound statement'; +declare c2 cursor for select a from t1; +select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement'; +select a from t1 into i; +select i as 'A local variable in a nested compound statement takes precedence over table column'; +open c2; +fetch c2 into i; +close c2; +select i as 'A local variable in a nested compound statement takes precedence over table column in cursors'; +end; +end; +end| +call p1("a - stored procedure parameter")| +a +a - stored procedure parameter +Parameter takes precedence over table column +a - stored procedure parameter +Parameter takes precedence over table column in cursors +a - stored procedure parameter +A local variable takes precedence over parameter +a - local variable +A local variable takes precedence over parameter in cursors +a - local variable +A local variable in a nested compound statement takes precedence over a local variable in the outer statement +a - local variable in a nested compound statement +A local variable in a nested compound statement takes precedence over table column +a - local variable in a nested compound statement +A local variable in a nested compound statement takes precedence over table column in cursors +a - local variable in a nested compound statement drop table t1,t2; --- 1.163/mysql-test/t/sp.test 2005-12-02 17:04:43 +03:00 +++ 1.164/mysql-test/t/sp.test 2005-12-02 22:43:46 +03:00 @@ -4898,7 +4898,52 @@ drop procedure bug14376| +# +# Bug#5967 "Stored procedure declared variable used instead of column" +# The bug should be fixed later. +# Test precedence of names of parameters, variable declarations, +# variable declarations in nested compound statements, table columns, +# table columns in cursor declarations. +# According to the standard, table columns take precedence over +# variable declarations. In MySQL 5.0 it's vice versa. +# +drop procedure if exists p1| +drop table if exists t1| +create table t1 (a varchar(255))| +insert into t1 (a) values ("a - table column")| +create procedure p1(a varchar(255)) +begin + declare i varchar(255); + declare c cursor for select a from t1; + select a; + select a from t1 into i; + select i as 'Parameter takes precedence over table column'; open c; + fetch c into i; + close c; + select i as 'Parameter takes precedence over table column in cursors'; + begin + declare a varchar(255) default 'a - local variable'; + declare c1 cursor for select a from t1; + select a as 'A local variable takes precedence over parameter'; + open c1; + fetch c1 into i; + close c1; + select i as 'A local variable takes precedence over parameter in cursors'; + begin + declare a varchar(255) default 'a - local variable in a nested compound statement'; + declare c2 cursor for select a from t1; + select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement'; + select a from t1 into i; + select i as 'A local variable in a nested compound statement takes precedence over table column'; + open c2; + fetch c2 into i; + close c2; + select i as 'A local variable in a nested compound statement takes precedence over table column in cursors'; + end; + end; +end| +call p1("a - stored procedure parameter")| # # BUG#NNNN: New bug synopsis