Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
DELIMITER $$
|
CREATE OR REPLACE PROCEDURE p1(a INT) |
BEGIN
|
DECLARE res INT DEFAULT 0; |
IF (a < 0) THEN |
SET res=x; |
END IF; |
END; |
$$
|
DELIMITER ;
|
Now if I call the procedure as follows:
CALL p1(0);
|
it still returns no errors.
It only returns an error if the condition in IF evaluates to true:
call p1(-1);
|
ERROR 1054 (42S22): Unknown column 'x' in 'field list'
|
This behavior makes it very difficult to design stored procedures.
The error should happen during CREATE PROCEDURE time.
In this context, x can only be a variable. It cannot be a column because no tables are involved.
Attachments
Issue Links
- relates to
-
MDEV-11953 support of brackets (parentheses) in UNION/EXCEPT/INTERSECT operations
- Closed
-
MDEV-22774 Invalid use of aggregate function in SP is not detected at CREATE time
- Open