diff options
author | unknown <igor@olga.mysql.com> | 2007-07-21 13:36:33 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-07-21 13:36:33 -0700 |
commit | 7507cbaaf047f56f320551ed70a4d372c0bda044 (patch) | |
tree | ee60b3dfcd726acd14295e91e74b5acdab0551a9 /mysql-test/t | |
parent | 3520da5b25227effdd24629836b72618dce9f958 (diff) | |
parent | aed9a5fee33affcf1dc2cd6355605438296aa903 (diff) | |
download | mariadb-git-7507cbaaf047f56f320551ed70a4d372c0bda044.tar.gz |
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug29911
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/sp.test | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index ef66f1c98f0..2bd499fd78a 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -23,6 +23,8 @@ use test; # --disable_warnings drop table if exists t1,t2,t3,t4; +drop function if exists f1; +drop function if exists f2; --enable_warnings create table t1 ( id char(16) not null default '', @@ -7098,7 +7100,7 @@ CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb; set @a=0; delimiter |; -CREATE function bug27354() RETURNS int deterministic +CREATE function bug27354() RETURNS int not deterministic begin insert into t1 values (null); set @a=@a+1; @@ -7172,4 +7174,33 @@ use test; drop procedure sp_bug29050; drop table t1; +# +# Bug #29338: no optimization for stored functions with a trivial body +# always returning constant. +# + +CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2; +CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3; + +CREATE TABLE t1 (c1 INT, INDEX(c1)); + +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); + +CREATE VIEW v1 AS SELECT c1 FROM t1; + +EXPLAIN SELECT * FROM t1 WHERE c1=1; +EXPLAIN SELECT * FROM t1 WHERE c1=f1(); + +EXPLAIN SELECT * FROM v1 WHERE c1=1; +EXPLAIN SELECT * FROM v1 WHERE c1=f1(); + +EXPLAIN SELECT * FROM t1 WHERE c1=f2(10); +EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1); +EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand()); + + +DROP VIEW v1; +DROP FUNCTION f1; +DROP TABLE t1; + --echo End of 5.0 tests |