summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2005-04-22 12:53:48 +0200
committerunknown <pem@mysql.comhem.se>2005-04-22 12:53:48 +0200
commit83a8ee38e02791de1fe53a19d6cbca21edca6f97 (patch)
tree16dd7ce5d1e2706f17774842c3d21d96d28bbe63
parent4f1f0b670bf0f67b4856c9805f3a1b73c2e2915a (diff)
downloadmariadb-git-83a8ee38e02791de1fe53a19d6cbca21edca6f97.tar.gz
Fixed BUG#9004: Inconsistent behaviour of SP re. warnings
mysql-test/r/sp.result: New test case for BUG#9004. Also updated some other results, since formerly "invisible" (but correct) warnings now are visible. mysql-test/t/sp.test: New test case for BUG#9004. sql/sql_error.cc: Don't reset warnings while executing a stored routine. sql/sql_parse.cc: Don't reset warnings while executing a stored routine.
-rw-r--r--mysql-test/r/sp.result31
-rw-r--r--mysql-test/t/sp.test24
-rw-r--r--sql/sql_error.cc2
-rw-r--r--sql/sql_parse.cc6
4 files changed, 60 insertions, 3 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 4f2d0d69395..9f28acbcb7d 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -667,6 +667,8 @@ delete from t1|
drop table if exists t3|
create table t3 ( s char(16), d int)|
call into_test4()|
+Warnings:
+Warning 1329 No data to FETCH
select * from t3|
s d
into4 NULL
@@ -1792,7 +1794,12 @@ end if;
insert into t4 values (2, rc, t3);
end|
call bug1863(10)|
+Warnings:
+Note 1051 Unknown table 'temp_t1'
+Warning 1329 No data to FETCH
call bug1863(10)|
+Warnings:
+Warning 1329 No data to FETCH
select * from t4|
f1 rc t3
2 0 NULL
@@ -2090,7 +2097,11 @@ begin
end|
call bug4579_1()|
call bug4579_1()|
+Warnings:
+Warning 1329 No data to FETCH
call bug4579_1()|
+Warnings:
+Warning 1329 No data to FETCH
drop procedure bug4579_1|
drop procedure bug4579_2|
drop table t3|
@@ -3010,4 +3021,24 @@ select @x|
@x
2005
drop function bug8861|
+drop procedure if exists bug9004_1|
+drop procedure if exists bug9004_2|
+create procedure bug9004_1(x char(16))
+begin
+insert into t1 values (x, 42);
+insert into t1 values (x, 17);
+end|
+create procedure bug9004_2(x char(16))
+call bug9004_1(x)|
+call bug9004_1('12345678901234567')|
+Warnings:
+Warning 1265 Data truncated for column 'id' at row 1
+Warning 1265 Data truncated for column 'id' at row 2
+call bug9004_2('12345678901234567890')|
+Warnings:
+Warning 1265 Data truncated for column 'id' at row 1
+Warning 1265 Data truncated for column 'id' at row 2
+delete from t1|
+drop procedure bug9004_1|
+drop procedure bug9004_2|
drop table t1,t2;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 1974cf2eab5..7b3bff4eb55 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -3701,6 +3701,30 @@ drop function bug8861|
#
+# BUG#9004: Inconsistent behaviour of SP re. warnings
+#
+--disable_warnings
+drop procedure if exists bug9004_1|
+drop procedure if exists bug9004_2|
+--enable_warnings
+create procedure bug9004_1(x char(16))
+begin
+ insert into t1 values (x, 42);
+ insert into t1 values (x, 17);
+end|
+create procedure bug9004_2(x char(16))
+ call bug9004_1(x)|
+
+# Truncation warnings expected...
+call bug9004_1('12345678901234567')|
+call bug9004_2('12345678901234567890')|
+
+delete from t1|
+drop procedure bug9004_1|
+drop procedure bug9004_2|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 04fd27abef5..3bda16202b9 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -113,7 +113,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level,
!(thd->options & OPTION_SQL_NOTES))
DBUG_RETURN(0);
- if (thd->query_id != thd->warn_id)
+ if (thd->query_id != thd->warn_id && !thd->spcont)
mysql_reset_errors(thd, 0);
thd->got_warning= 1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index bef35dcfd0d..c5ef9f4e713 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2268,9 +2268,11 @@ mysql_execute_command(THD *thd)
A better approach would be to reset this for any commands
that is not a SHOW command or a select that only access local
variables, but for now this is probably good enough.
+ Don't reset warnings when executing a stored routine.
*/
- if (all_tables || &lex->select_lex != lex->all_selects_list ||
- lex->spfuns.records || lex->spprocs.records)
+ if ((all_tables || &lex->select_lex != lex->all_selects_list ||
+ lex->spfuns.records || lex->spprocs.records) &&
+ !thd->spcont)
mysql_reset_errors(thd, 0);
#ifdef HAVE_REPLICATION