List:Commits« Previous MessageNext Message »
From:marc.alff Date:October 18 2006 10:08pm
Subject:bk commit into 5.1 tree (malff:1.2352)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of marcsql. When marcsql 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@stripped, 2006-10-18 15:08:41-07:00, malff@weblab.(none) +6 -0
  Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-20028_gca
  into  weblab.(none):/home/marcsql/TREE/mysql-5.1-20028_b
  MERGE: 1.1810.2114.24

  mysql-test/r/sp-vars.result@stripped, 2006-10-18 15:03:31-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.1.2.1

  mysql-test/r/sp.result@stripped, 2006-10-18 15:04:59-07:00, malff@weblab.(none) +0 -130
    e
    MERGE: 1.170.26.1

  mysql-test/r/trigger.result@stripped, 2006-10-18 15:08:36-07:00, malff@weblab.(none) +4 -60
    MERGE: 1.29.1.18

  mysql-test/t/sp.test@stripped, 2006-10-18 15:03:32-07:00, malff@weblab.(none) +1 -2
    Auto merged
    MERGE: 1.174.21.1

  mysql-test/t/trigger.test@stripped, 2006-10-18 15:03:32-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.34.1.19

  sql/sp_head.cc@stripped, 2006-10-18 15:03:32-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.200.1.25

# 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:	malff
# Host:	weblab.(none)
# Root:	/home/marcsql/TREE/mysql-5.1-20028_b/RESYNC

--- 1.7/mysql-test/r/sp-vars.result	2006-10-18 15:08:47 -07:00
+++ 1.8/mysql-test/r/sp-vars.result	2006-10-18 15:08:47 -07:00
@@ -4,6 +4,7 @@ DROP FUNCTION IF EXISTS sp_vars_check_re
 DROP FUNCTION IF EXISTS sp_vars_check_ret2;
 DROP FUNCTION IF EXISTS sp_vars_check_ret3;
 DROP FUNCTION IF EXISTS sp_vars_check_ret4;
+DROP FUNCTION IF EXISTS sp_vars_div_zero;
 SET @@sql_mode = 'ansi';
 CREATE PROCEDURE sp_vars_check_dflt()
 BEGIN
@@ -88,6 +89,12 @@ CREATE FUNCTION sp_vars_check_ret4() RET
 BEGIN
 RETURN 12 * 10 + 34 + 0.1234;
 END|
+CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
+BEGIN
+DECLARE div_zero INTEGER;
+SELECT 1/0 INTO div_zero;
+RETURN div_zero;
+END|
 
 ---------------------------------------------------------------
 Calling the routines, created in ANSI mode.
@@ -172,6 +179,9 @@ sp_vars_check_ret4()
 154.12
 Warnings:
 Note	1265	Data truncated for column 'sp_vars_check_ret4()' at row 1
+SELECT sp_vars_div_zero();
+sp_vars_div_zero()
+NULL
 SET @@sql_mode = 'traditional';
 
 ---------------------------------------------------------------
@@ -257,12 +267,16 @@ sp_vars_check_ret4()
 154.12
 Warnings:
 Note	1265	Data truncated for column 'sp_vars_check_ret4()' at row 1
+SELECT sp_vars_div_zero();
+sp_vars_div_zero()
+NULL
 DROP PROCEDURE sp_vars_check_dflt;
 DROP PROCEDURE sp_vars_check_assignment;
 DROP FUNCTION sp_vars_check_ret1;
 DROP FUNCTION sp_vars_check_ret2;
 DROP FUNCTION sp_vars_check_ret3;
 DROP FUNCTION sp_vars_check_ret4;
+DROP FUNCTION sp_vars_div_zero;
 CREATE PROCEDURE sp_vars_check_dflt()
 BEGIN
 DECLARE v1 TINYINT DEFAULT 1e200;
@@ -346,6 +360,12 @@ CREATE FUNCTION sp_vars_check_ret4() RET
 BEGIN
 RETURN 12 * 10 + 34 + 0.1234;
 END|
+CREATE FUNCTION sp_vars_div_zero() RETURNS INTEGER
+BEGIN
+DECLARE div_zero INTEGER;
+SELECT 1/0 INTO div_zero;
+RETURN div_zero;
+END|
 
 ---------------------------------------------------------------
 Calling the routines, created in TRADITIONAL mode.
@@ -366,6 +386,8 @@ sp_vars_check_ret4()
 154.12
 Warnings:
 Note	1265	Data truncated for column 'sp_vars_check_ret4()' at row 1
+SELECT sp_vars_div_zero();
+ERROR 22012: Division by 0
 SET @@sql_mode = 'ansi';
 DROP PROCEDURE sp_vars_check_dflt;
 DROP PROCEDURE sp_vars_check_assignment;
@@ -373,6 +395,7 @@ DROP FUNCTION sp_vars_check_ret1;
 DROP FUNCTION sp_vars_check_ret2;
 DROP FUNCTION sp_vars_check_ret3;
 DROP FUNCTION sp_vars_check_ret4;
+DROP FUNCTION sp_vars_div_zero;
 
 ---------------------------------------------------------------
 BIT data type tests

--- 1.53/mysql-test/t/trigger.test	2006-10-18 15:08:47 -07:00
+++ 1.54/mysql-test/t/trigger.test	2006-10-18 15:08:47 -07:00
@@ -1274,7 +1274,6 @@ INSERT INTO t1 VALUES (@x);
 SELECT @x;
 
 SET @x=2;
---error ER_DIVISION_BY_ZERO
 UPDATE t1 SET i1 = @x;
 SELECT @x;
 
@@ -1285,7 +1284,6 @@ INSERT INTO t1 VALUES (@x);
 SELECT @x;
 
 SET @x=4;
---error ER_DIVISION_BY_ZERO
 UPDATE t1 SET i1 = @x;
 SELECT @x;
 
@@ -1420,6 +1418,67 @@ CREATE DEFINER=some_user_name@1234567890
 DROP TABLE t1;
 DROP TABLE t2;
 
+#
+# Bug#20028 Function with select return no data
+# 
+
+--disable_warnings
+drop table if exists t1;
+drop table if exists t2;
+drop table if exists t3;
+drop table if exists t4;
+--enable_warnings
+
+SET @save_sql_mode=@@sql_mode;
+
+delimiter |;
+SET sql_mode='TRADITIONAL'|
+create table t1 (id int(10) not null primary key, v int(10) )|
+create table t2 (id int(10) not null primary key, v int(10) )|
+create table t3 (id int(10) not null primary key, v int(10) )|
+create table t4 (c int)|
+
+create trigger t4_bi before insert on t4 for each row set @t4_bi_called:=1|
+create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1|
+
+insert into t1 values(10, 10)|
+set @a:=1/0|
+select 1/0 from t1|
+
+create trigger t1_bi before insert on t1 for each row set @a:=1/0|
+
+insert into t1 values(20, 20)|
+
+drop trigger t1_bi|
+create trigger t1_bi before insert on t1 for each row
+begin
+  insert into t2 values (new.id, new.v);
+  update t2 set v=v+1 where id= new.id;
+  replace t3 values (new.id, 0);
+  update t2, t3 set t2.v=new.v, t3.v=new.v where t2.id=t3.id;
+  create temporary table t5 select * from t1;
+  delete from t5;
+  insert into t5 select * from t1;
+  insert into t4 values (0);
+  set @check= (select count(*) from t5);
+  update t4 set c= @check;
+  drop temporary table t5;
+
+  set @a:=1/0;
+end|
+
+set @check=0, @t4_bi_called=0, @t4_bu_called=0|
+insert into t1 values(30, 30)|
+select @check, @t4_bi_called, @t4_bu_called|
+
+delimiter ;|
+
+SET @@sql_mode=@save_sql_mode;
+
+drop table t1;
+drop table t2;
+drop table t3;
+drop table t4;
 
 #
 # Bug#20670 "UPDATE using key and invoking trigger that modifies

--- 1.209/mysql-test/t/sp.test	2006-10-18 15:08:47 -07:00
+++ 1.210/mysql-test/t/sp.test	2006-10-18 15:08:47 -07:00
@@ -6421,6 +6421,139 @@ DROP TABLE t3,t4|
 
 --echo End of 5.0 tests
 
+#
+# Bug#20028 Function with select return no data
+#
+
+--disable_warnings
+drop function if exists func_20028_a|
+drop function if exists func_20028_b|
+drop function if exists func_20028_c|
+drop procedure if exists proc_20028_a|
+drop procedure if exists proc_20028_b|
+drop procedure if exists proc_20028_c|
+drop table if exists table_20028|
+--enable_warnings
+
+create table table_20028 (i int)|
+
+SET @save_sql_mode=@@sql_mode|
+
+SET sql_mode=''|
+
+create function func_20028_a() returns integer
+begin
+  declare temp integer;
+  select i into temp from table_20028 limit 1;
+  return ifnull(temp, 0);
+end|
+
+create function func_20028_b() returns integer
+begin
+  return func_20028_a();
+end|
+
+create function func_20028_c() returns integer
+begin
+  declare div_zero integer;
+  set SQL_MODE='TRADITIONAL';
+  select 1/0 into div_zero;
+  return div_zero;
+end|
+
+create procedure proc_20028_a()
+begin
+  declare temp integer;
+  select i into temp from table_20028 limit 1;
+end|
+
+create procedure proc_20028_b()
+begin
+  call proc_20028_a();
+end|
+
+create procedure proc_20028_c()
+begin
+  declare div_zero integer;
+  set SQL_MODE='TRADITIONAL';
+  select 1/0 into div_zero;
+end|
+
+select func_20028_a()|
+select func_20028_b()|
+--error ER_DIVISION_BY_ZERO
+select func_20028_c()|
+call proc_20028_a()|
+call proc_20028_b()|
+--error ER_DIVISION_BY_ZERO
+call proc_20028_c()|
+
+SET sql_mode='TRADITIONAL'|
+
+drop function func_20028_a|
+drop function func_20028_b|
+drop function func_20028_c|
+drop procedure proc_20028_a|
+drop procedure proc_20028_b|
+drop procedure proc_20028_c|
+
+create function func_20028_a() returns integer
+begin
+  declare temp integer;
+  select i into temp from table_20028 limit 1;
+  return ifnull(temp, 0);
+end|
+
+create function func_20028_b() returns integer
+begin
+  return func_20028_a();
+end|
+
+create function func_20028_c() returns integer
+begin
+  declare div_zero integer;
+  set SQL_MODE='';
+  select 1/0 into div_zero;
+  return div_zero;
+end|
+
+create procedure proc_20028_a()
+begin
+  declare temp integer;
+  select i into temp from table_20028 limit 1;
+end|
+
+create procedure proc_20028_b()
+begin
+  call proc_20028_a();
+end|
+
+create procedure proc_20028_c()
+begin
+  declare div_zero integer;
+  set SQL_MODE='';
+  select 1/0 into div_zero;
+end|
+
+select func_20028_a()|
+select func_20028_b()|
+select func_20028_c()|
+call proc_20028_a()|
+call proc_20028_b()|
+call proc_20028_c()|
+
+SET @@sql_mode=@save_sql_mode|
+
+drop function func_20028_a|
+drop function func_20028_b|
+drop function func_20028_c|
+drop procedure proc_20028_a|
+drop procedure proc_20028_b|
+drop procedure proc_20028_c|
+drop table table_20028|
+
+--echo End of 5.0 tests
+
 
 #
 # BUG#NNNN: New bug synopsis

--- 1.240/sql/sp_head.cc	2006-10-18 15:08:47 -07:00
+++ 1.241/sql/sp_head.cc	2006-10-18 15:08:47 -07:00
@@ -1029,8 +1029,7 @@ sp_head::execute(THD *thd)
   save_sql_mode= thd->variables.sql_mode;
   thd->variables.sql_mode= m_sql_mode;
   save_abort_on_warning= thd->abort_on_warning;
-  thd->abort_on_warning=
-    (m_sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
+  thd->abort_on_warning= 0;
 
   /*
     It is also more efficient to save/restore current thd->lex once when
Thread
bk commit into 5.1 tree (malff:1.2352)marc.alff19 Oct