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

HEX hybrid is treated as a number in string context

    XMLWordPrintable

Details

    Description

      I run the following SQL script with a MyISAM table:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(4)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('122'),('z');
      SELECT CONCAT(a, 0x7A) FROM t1;
      SELECT * FROM t1 WHERE a=0x7A;
      

      It returns these results:

      +-----------------+
      | CONCAT(a, 0x7A) |
      +-----------------+
      | 122z            |
      | zz              |
      +-----------------+
      

      +------+
      | a    |
      +------+
      | z    |
      +------+
      

      Now I repeat the same script with ColumnStore:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a CHAR(10)) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('122'),('z');
      SELECT CONCAT(a, 0x7A) FROM t1;
      SELECT * FROM t1 WHERE a=0x7A;
      

      It returns different results:

      +-----------------+
      | CONCAT(a, 0x7A) |
      +-----------------+
      | 122122          |
      | z122            |
      +-----------------+
      

      +------+
      | a    |
      +------+
      | 122  |
      +------+
      

      It seems a hex hybrid is always treated as a number in ColumnStore.

      It should be fixed to behave like in MariaDB:

      • as a character string in string context
      • as a number in numeric context

      The same problem is repeatable with VARCHAR and TEXT instead of CHAR.

      Attachments

        Issue Links

          Activity

            People

              leonid.fedorov Leonid Fedorov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.