Skip to content

Stored function code is messed up if the return type contains an ENUM/SET value with whitespace #768

@Spavid04

Description

@Spavid04

Steps to reproduce this issue

  1. Create a new function. Modifiers and properties do not matter.
  2. Set its return value to an ENUM or a SET with values containing whitespace. Whitespace-containing string literals should be allowed as per the MySQL standard, though it is not explicitly stated.
  3. Refresh Heidi's view of the function. I have switched to a table definition, and then back to the function.

Reference code:

CREATE DEFINER=`root`@`localhost` FUNCTION `test_function`()
RETURNS ENUM('unknown', 'not known', 'not_known')
LANGUAGE SQL
DETERMINISTIC
NO SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
	RETURN 'unknown';
END

Other notes:

  • single or double quotes do not change the behaviour
  • whitespace-containing enums/sets in the parameter list seem to be working properly
  • SHOW CREATE FUNCTION test_function returns good SQL, and the function executes properly

Current behavior

The "Option" tab loses all properties defined after the return type (in SQL code), and the return type is incorrect (see screenshot below). The "Routine body" area displays invalid SQL.
options_tab

The "CREATE code" tab mangles the SQL code after the first whitespace:

CREATE DEFINER=`root`@`localhost` FUNCTION `test_function`()
RETURNS enum('unknown','not
LANGUAGE SQL
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
known','not_known') CHARSET latin1
    NO SQL
    DETERMINISTIC
BEGIN
	RETURN 'unknown';END

Expected behavior

Correct values should be displayed in the "Options" tab.

Correct SQL code should be displayed in the "CREATE code" tab.

Possible solution

Return type string literals in ENUM/SET should be treated as any other string literal.

Environment

I believe this issue is environment-agnostic, but have not tested more.

  • HeidiSQL version: 10.2.0.5712
  • Database system and version: MariaDB 10.4.8
  • Operating system: Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDefective behaviour in HeidiSQLnettype-mysqlMySQL and/or MariaDB specific issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions