Bug #97288 function execution 2 or 3 times crash the server
Submitted: 18 Oct 13:04 Modified: 18 Oct 13:52
Reporter: Franco Pellegrini Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S1 (Critical)
Version:10.4.8-MariaDB OS:Microsoft Windows (10)
Assigned to: CPU Architecture:x86 (64)
Tags: cash, FUNCTION, server

[18 Oct 13:04] Franco Pellegrini
Description:
If I execute more than one time this function, the server crash with no errors.
The function try to search 2 columns in 2 tables, and return true if they exists on both tables.

How to repeat:
execute manually 2 or 3 times this function (in short period of time)

CREATE FUNCTION if_column_exists_normal_and_backup(tableNameToSearch TINYTEXT,
                                                   columnNameToSearch TINYTEXT)
    RETURNS BOOLEAN
    LANGUAGE SQL
BEGIN
    SET @original = tableNameToSearch;
    SET @backup = CONCAT(tableNameToSearch, '_backup');

    RETURN (
            exists(SELECT COLUMN_NAME
                   FROM INFORMATION_SCHEMA.COLUMNS
                   WHERE TABLE_NAME = @original
                     AND COLUMN_NAME = `columnnametosearch`
                )
            AND
            exists(SELECT COLUMN_NAME
                   FROM INFORMATION_SCHEMA.COLUMNS
                   WHERE TABLE_NAME = @backup
                     AND COLUMN_NAME = `columnnametosearch`
                )
        );
END
[18 Oct 13:52] Miguel Solorzano
Thank you for the bug report. The server version reported isn't supported, try with an Oracle MySQL server and report again if happens the issue too.
[18 Oct 13:53] Valeriy Kravchuk
Please, either check if any recent MySQL version (like 8.0.18) is also affected, or report this to MariaDB: https://jira.mariadb.org