go-mysql-server
go-mysql-server copied to clipboard
Stored procedure argument is not accessible in EXISTS subquery
Summary
When calling a stored procedure, an argument passed to the procedure is not accessible within a subquery of an EXISTS clause.
This appears to be a regression, as this functionality was working correctly in v0.19.0 but is now broken in the latest version.
Steps to Reproduce
- Define a stored procedure with a parameter used inside an EXISTS subquery.
- Call the stored procedure with an argument.
Define and call a stored procedure
DELIMITER //
CREATE PROCEDURE myproc(IN input int)
BEGIN
SELECT 1 WHERE EXISTS (SELECT input);
END//
DELIMITER ;
CALL myproc(1);
Expected behavior
The query should execute successfully just as it does in MySQL.
Actural Behavior
The following error is returned:
ERROR 1105 (HY000): column "input" could not be found in any table in scope