=== added file 'mysql-test/r/signal_demo3.result'
--- a/mysql-test/r/signal_demo3.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/signal_demo3.result	2008-06-13 17:06:59 +0000
@@ -0,0 +1,82 @@
+drop database if exists demo;
+create database demo;
+use demo;
+create procedure proc_1()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_1';
+call proc_2();
+end
+$$
+create procedure proc_2()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_2';
+call proc_3();
+end
+$$
+create procedure proc_3()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_3';
+call proc_4();
+end
+$$
+create procedure proc_4()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_4';
+call proc_5();
+end
+$$
+create procedure proc_5()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_5';
+call proc_6();
+end
+$$
+create procedure proc_6()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_6';
+call proc_7();
+end
+$$
+create procedure proc_7()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_7';
+call proc_8();
+end
+$$
+create procedure proc_8()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_8';
+call proc_9();
+end
+$$
+create procedure proc_9()
+begin
+declare exit handler for sqlexception
+resignal sqlstate '55555' set message_text='Oops in proc_9';
+## Do something that fails, to see how errors are reported
+drop table oops_it_is_not_here;
+end
+$$
+call proc_1();
+ERROR 55555: Oops in proc_1
+show warnings;
+Level	Code	Message
+Error	1051	Unknown table 'oops_it_is_not_here'
+Error	1677	Oops in proc_9
+Error	1677	Oops in proc_8
+Error	1677	Oops in proc_7
+Error	1677	Oops in proc_6
+Error	1677	Oops in proc_5
+Error	1677	Oops in proc_4
+Error	1677	Oops in proc_3
+Error	1677	Oops in proc_2
+Error	1677	Oops in proc_1
+drop database demo;

=== modified file 'mysql-test/r/signal_utf32.result'
--- a/mysql-test/r/signal_utf32.result	2008-06-11 22:53:47 +0000
+++ b/mysql-test/r/signal_utf32.result	2008-06-13 17:06:59 +0000
@@ -19,3 +19,12 @@
 Warnings:
 Warning	1675	HELLO
 drop procedure test_signal $$
+create procedure test_signal()
+begin
+declare continue handler for sqlexception
+resignal set message_text = repeat(_utf32 0x000100cc, 128);
+signal sqlstate '77777';
+end $$
+call test_signal() $$
+ERROR 77777: 𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌𐃌
+drop procedure test_signal $$

=== added file 'mysql-test/t/signal_demo3.test'
--- a/mysql-test/t/signal_demo3.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/signal_demo3.test	2008-06-13 17:06:59 +0000
@@ -0,0 +1,124 @@
+# Copyright (C) 2008 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+#
+# Demonstrate how RESIGNAL can be used to print a stack trace
+#
+
+--disable_warnings
+drop database if exists demo;
+--enable_warnings
+
+create database demo;
+
+use demo;
+
+delimiter $$;
+
+create procedure proc_1()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_1';
+
+  call proc_2();
+end
+$$
+
+create procedure proc_2()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_2';
+
+  call proc_3();
+end
+$$
+
+create procedure proc_3()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_3';
+
+  call proc_4();
+end
+$$
+
+create procedure proc_4()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_4';
+
+  call proc_5();
+end
+$$
+
+create procedure proc_5()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_5';
+
+  call proc_6();
+end
+$$
+
+create procedure proc_6()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_6';
+
+  call proc_7();
+end
+$$
+
+create procedure proc_7()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_7';
+
+  call proc_8();
+end
+$$
+
+create procedure proc_8()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_8';
+
+  call proc_9();
+end
+$$
+
+create procedure proc_9()
+begin
+  declare exit handler for sqlexception
+    resignal sqlstate '55555' set message_text='Oops in proc_9';
+
+  ## Do something that fails, to see how errors are reported
+  drop table oops_it_is_not_here;
+end
+$$
+
+delimiter ;$$
+
+-- error ER_SIGNAL_EXCEPTION
+call proc_1();
+
+# This is the interesting part:
+# the complete call stack from the origin of failure (proc_9)
+# to the top level caller (proc_1) is available ...
+
+show warnings;
+
+drop database demo;
+

=== modified file 'mysql-test/t/signal_utf32.test'
--- a/mysql-test/t/signal_utf32.test	2008-06-11 22:53:47 +0000
+++ b/mysql-test/t/signal_utf32.test	2008-06-13 17:06:59 +0000
@@ -43,6 +43,17 @@
 call test_signal() $$
 drop procedure test_signal $$
 
+create procedure test_signal()
+begin
+  declare continue handler for sqlexception
+    resignal set message_text = repeat(_utf32 0x000100cc, 128);
+
+  signal sqlstate '77777';
+end $$
+
+--error ER_SIGNAL_EXCEPTION
+call test_signal() $$
+drop procedure test_signal $$
+
 delimiter ;$$
 
-


