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

VARCHAR(2) NOT NULL: explicit empty string gets converted to DEFAULT

    XMLWordPrintable

Details

    Description

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

      +--------+
      | HEX(a) |
      +--------+
      | 6161   |
      +--------+
      

      Notice, emptry string was conversion to default 'aa'. Looks wrong.

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

      +--------+
      | HEX(a) |
      +--------+
      | 20     |
      +--------+
      

      Notice, emptry string was conversion to default ' '. Looks wrong.

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

      +--------+
      | HEX(a) |
      +--------+
      | 2020   |
      +--------+
      

      Notice, emptry string was conversion to default ' '. Looks wrong.

      In all above scenarios, INSERTs should:

      • either fail on NOT NULL violation for now
      • or insert an empty string (when we fix the flaw that emptry string is NULL)

      But it should not replace to DEFAULT!

      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.