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

Pluggable data type fails type aggregation with NULL and string operands

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.1
    • 13.1
    • Plugins
    • None
    • Can result in unexpected behaviour

    Description

      Pluggable data type fails type aggregation with NULL and string operands

      INSTALL SONAME 'type_test';
      CREATE TABLE t (g INT, i test_int8, d test_double);
      INSERT INTO t VALUES (1, 10, 1.5), (5, 20, 2.5);
       
      SELECT i + NULL FROM t;
      -- ERROR 4078 (HY000): Illegal parameter data types test_int8 and null for operation '+'
      SELECT i + '3' FROM t;                     -- 4078, operation '+'
      SELECT CASE WHEN g>3 THEN i ELSE NULL END FROM t;   -- 4078, 'case'
      SELECT CASE WHEN g>3 THEN i ELSE 'x'  END FROM t;   -- 4078, 'case'
      SELECT COALESCE(i, NULL) FROM t;           -- 4078, 'coalesce'
      SELECT IFNULL(d, NULL)   FROM t;           -- 4078, 'ifnull'
      SELECT LEAST(i, NULL)    FROM t;           -- 4078, 'least'
      SELECT i FROM t UNION SELECT NULL;         -- 4078
      SELECT i FROM t UNION SELECT 'x';          -- 4078
      

      CLI Output

      13.1.0-opt>INSTALL SONAME 'type_test';
      Query OK, 0 rows affected (0.002 sec)
       
      13.1.0-opt>CREATE TABLE t (g INT, i test_int8, d test_double);
      Query OK, 0 rows affected (0.008 sec)
       
      13.1.0-opt>INSERT INTO t VALUES (1, 10, 1.5), (5, 20, 2.5);
      Query OK, 2 rows affected (0.001 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      13.1.0-opt>
      13.1.0-opt>SELECT i + NULL FROM t;
      ERROR 4078 (HY000): Illegal parameter data types test_int8 and null for operation '+'
      13.1.0-opt>
      13.1.0-opt>SELECT i + '3' FROM t;
      ERROR 4078 (HY000): Illegal parameter data types test_int8 and varchar for operation '+'
      13.1.0-opt>
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5h
                0.5h

                Git Integration

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