-
-
Notifications
You must be signed in to change notification settings - Fork 606
Closed
Labels
bugSomething isn't workingSomething isn't workingcorrectnessWe don't return the same result as MySQLWe don't return the same result as MySQLcustomer issuegood reproEasily reproducible bugsEasily reproducible bugs
Description
I am trying to set up a procedure, that (among other things) calculates an age based on the diff of a parameter and some value in the dataset.
When I manually SELECT the parameter value, it gets displayed as normal, but as soon as I JOIN another table, do it inside a subquery or use it in a function, it just "can't find the column in any table in scope".
> CREATE PROCEDURE p(IN p_birthday DATE) SELECT TIMESTAMPDIFF(YEAR, p_birthday, NOW());
> CALL p(DATE '2022-02-17');
Error 1105 (HY000): column "p_birthday" could not be found in any table in scope
> DROP PROCEDURE p;
> CREATE PROCEDURE p(IN p_birthday DATE) SELECT p_birthday AS birthday;
> CALL p(DATE '2022-02-17');
+-------------------------------+
| birthday |
+-------------------------------+
| 2022-02-17 00:00:00 +0000 UTC |
+-------------------------------+
> DROP PROCEDURE p;
> CREATE PROCEDURE p(IN p_birthday DATE) SELECT TIMESTAMPDIFF(YEAR, (SELECT p_birthday AS birthday), NOW());
> CALL p(DATE '2022-02-17');
Error 1105 (HY000): column "p_birthday" could not be found in any table in scope
>
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcorrectnessWe don't return the same result as MySQLWe don't return the same result as MySQLcustomer issuegood reproEasily reproducible bugsEasily reproducible bugs