go-mysql-server icon indicating copy to clipboard operation
go-mysql-server copied to clipboard

Stored procedure argument is not accessible in EXISTS subquery

Open makiuchi-d opened this issue 5 months ago • 0 comments

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

  1. Define a stored procedure with a parameter used inside an EXISTS subquery.
  2. 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

makiuchi-d avatar Jun 17 '25 06:06 makiuchi-d