Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.5, 10.6
-
None
Description
If a stored procedure contains an output parameter with a certain name, and if the procedure selects a column of with the same name, the selected value is reported inside the procedure as NULL.
The issue also present when the SELECT is run in a cursor with a subsequent FETCH - the fetched value is NULL.
The error occurs on any data type (the example below shows JSON, but it also happens on INT etc.)
Example:
CREATE TABLE `t` (
|
`id` int(11) DEFAULT NULL,
|
`value` JSON
|
) ENGINE=InnoDB
|
|
INSERT INTO t VALUES (1, '[42]');
|
INSERT INTO t VALUES (2, '[69]');
|
|
CREATE OR REPLACE PROCEDURE TEST_JSON()
|
BEGIN
|
SELECT id, value FROM t;
|
END;
|
|
MariaDB [test]> call TEST_JSON();
|
+------+-------+
|
| id | value |
|
+------+-------+
|
| 1 | [42] |
|
| 1 | [69] |
|
+------+-------+
|
|
CREATE OR REPLACE PROCEDURE TEST_JSON(OUT value JSON)
|
BEGIN
|
SELECT id, value FROM t;
|
END;
|
|
MariaDB [test]> call TEST_JSON(@a);
|
+------+-------+
|
| id | value |
|
+------+-------+
|
| 1 | NULL |
|
| 1 | NULL |
|
+------+-------+
|