Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4579

CHAR(2) NULL: empty strings or SPACE(N) get converted to NULL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5.1
    • Fix Version/s: 23.02
    • Component/s: PrimProc
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(2) DEFAULT '') ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('');
      INSERT INTO t1 VALUES (' ');
      INSERT INTO t1 VALUES ('  ');
      SELECT HEX(a) FROM t1;
      

      +--------+
      | HEX(a) |
      +--------+
      | NULL   |
      | NULL   |
      | NULL   |
      +--------+
      

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(2) DEFAULT 'aa') ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('');
      INSERT INTO t1 VALUES (' ');
      INSERT INTO t1 VALUES ('  ');
      SELECT HEX(a) FROM t1;
      

      +--------+
      | HEX(a) |
      +--------+
      | NULL   |
      | NULL   |
      | NULL   |
      +--------+
      

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(2) DEFAULT ' ') ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('');
      INSERT INTO t1 VALUES (' ');
      INSERT INTO t1 VALUES ('  ');
      SELECT HEX(a) FROM t1;
      

      +--------+
      | HEX(a) |
      +--------+
      | NULL   |
      | NULL   |
      | NULL   |
      +--------+
      

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(2) DEFAULT '  ') ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('');
      INSERT INTO t1 VALUES (' ');
      INSERT INTO t1 VALUES ('  ');
      SELECT HEX(a) FROM t1;
      

      +--------+
      | HEX(a) |
      +--------+
      | NULL   |
      | NULL   |
      | NULL   |
      +--------+
      

      In all above cases, empty strings as well as strings consisting only of space characters were replaced to NULL. Looks wrong.

      Also, inserting an empty string should:

      • either store NULL for now (like it does)
      • or store the true empty string (when we fix the flaw that an empty string is NULL)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sergey.zefirov Sergey Zefirov
              Reporter:
              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.