WL#2110: Stored Procedures: Implement SIGNAL

Affects: Server-5.5   —   Status: Complete

MySQL will implement the standard SQL (SQL:2003) SIGNAL
statement, which is used to signal a rule violation
(i.e. an error or a warning) during routine execution.

History:
Discussion of SIGNAL has been going on since 2003.
At the Malta conference it was said to be "due for 5.1".
In the Santa Cruz Dev-Mt Offsite meeting (2006-08), Brian
and Monty made some time estimates and statements about
dependencies (see "Progress Reports" for details).
In the Customer Advisory Board meeting (2006-12), customers
said that SIGNAL even without RESIGNAL would be useful.

Rationale:
There are feature requests. It's in the standard.
It's been part of the plan for some time, and it's
on the roadmap's "must have" list now for version 6.x.
There's no other good user-controlled way to report errors.

Compatibility:
IBM DB2 supports SIGNAL in the standard-SQL manner.
Sybase SQL Anywhere supports it in a slightly less standard manner.
Oracle and SQL Server don't support SIGNAL, but do 
provide similar functionality for diagnostic checking 
within stored procedures (Oracle provides the 
RAISE  statement; SQL Server the 
RAISERROR  statement).

We don't need yet to store all signal information in the
diagnostics area in the server, since the only way to retrieve that
data is with GET DIAGNOSTICS (WL#2111), which might come later.
The WL dependencies are:
- SIGNAL can be implemented by itself,
- RESIGNAL depends on SIGNAL
- GET DIAGNOSTICS depends on both SIGNAL and RESIGNAL for testing reasons.