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

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.1
    • N/A
    • PrimProc
    • 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

              sergey.zefirov Sergey Zefirov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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