Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12503

Inconsistent behavior when mixing ENUM+GEOMETRY for functions vs UNION

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.3
    • 10.4
    • Data types
    • None

    Description

      Mixing ENUM and GEOMETRY in hybrid functions creates a LONGBLOB column:

      DROP TABLE IF EXISTS t1,t2;
      CREATE TABLE t1 (a ENUM('a'), b Geometry);
      CREATE TABLE t2 AS SELECT LEAST(a,b), COALESCE(a,b) FROM t1;
      SHOW CREATE TABLE t2;
      

      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                             |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `LEAST(a,b)` longblob DEFAULT NULL,
        `COALESCE(a,b)` longblob DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------+
      

      Mixing ENUM and GEOMETRY for UNION returns an error:

      DROP TABLE t2;
      CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1;
      

      ERROR 4053 (HY000): Illegal parameter data types enum and geometry for operation 'UNION'
      

      It would be nice to have consistent behavior.

      The problem is that hybrid functions and UNION treat arguments differently:

      • functions operate in terms of field type and see ENUM as VARCHAR.
      • UNION operates in term of real field type and see ENUM as ENUM.

      Perhaps hybrid functions should be fixed to operate in terms of real field type.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.