Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.5.9, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
-
None
-
Red Hat 8
Description
The following procedure crashes the server if it is called twice, even with no data, it succeeds if you add a limit:
CREATE TABLE `TEST` ( |
`objectid` int(11) NOT NULL, |
`submissionid` int(11) DEFAULT NULL, |
`objectname` varchar(255) DEFAULT NULL, |
`objecturl` varchar(1000) DEFAULT NULL, |
`reviewercomment` varchar(1000) DEFAULT NULL, |
`isactive` tinyint(1) DEFAULT NULL, |
`createdon` datetime DEFAULT NULL, |
`createdby` varchar(255) DEFAULT NULL, |
`updatedon` datetime DEFAULT NULL, |
`updatedby` varchar(255) DEFAULT NULL |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|
MariaDB [mytest]> DELIMITER $$
|
MariaDB [mytest]> CREATE OR REPLACE PROCEDURE `testsp_doesnot_works`() |
BEGIN |
SET SESSION group_concat_max_len = 100000000000; |
|
SELECT JSON_EXTRACT( |
IFNULL(
|
(
|
SELECT CONCAT( |
'[', |
GROUP_CONCAT(
|
JSON_OBJECT(
|
'objectId', objectId, |
'objectName', objectName,'objectUrl', objectUrl,'reviewerComment', reviewerComment,'createdOn', DATE_FORMAT(createdOn,"%Y-%m-%dT%H:%i:%sZ") |
)
|
),
|
']' |
)
|
),
|
'[]' |
),
|
'$' |
) AS comments |
FROM(select objectId, objectName, objectUrl, reviewerComment, createdOn FROM `TEST`) AS body; |
END$$ |
Query OK, 0 rows affected (0.004 sec) |
|
MariaDB [mytest]> DELIMITER ;
|
It succeeds if you replace:
FROM(select objectId, objectName, objectUrl, reviewerComment, createdOn FROM `TEST`) AS body; |
|
with |
|
{code:sql}
|
FROM(select objectId, objectName, objectUrl, reviewerComment, createdOn FROM `TEST` LIMIT 50 ) AS body; |
If we return to 10.2 tree just before the commit 3690c549c6e72646ba74f6b4c83813ee4ac3aea4 (see above)
we get the same crash for the second execution of the prepared statement for the query
select (select sum(b) from t1 where a=1) from v1;
as for the second execution of the prepared statement for the query