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

Non-equality comparison operators do not work well with NOPAD collations

    XMLWordPrintable

Details

    Description

      Long VARCHAR:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('a');
      INSERT INTO t1 VALUES ('ã');
      INSERT INTO t1 VALUES ('a ');
      INSERT INTO t1 VALUES ('ã ');
      INSERT INTO t1 VALUES ('a  ');
      INSERT INTO t1 VALUES ('ã  ');
      SELECT quote(a) FROM t1 WHERE a<='a  ';
      

      +----------+
      | quote(a) |
      +----------+
      | 'a'      |
      +----------+
      

      Looks wrong. The condition should match all records.

      Short VARCHAR:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(4) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci) ENGINE=ColumnStore;
      INSERT INTO t1 VALUES ('a');
      INSERT INTO t1 VALUES ('ã');
      INSERT INTO t1 VALUES ('a ');
      INSERT INTO t1 VALUES ('ã ');
      INSERT INTO t1 VALUES ('a  ');
      INSERT INTO t1 VALUES ('ã  ');
      SELECT quote(a) FROM t1 WHERE a<='a  ';
      

      +----------+
      | quote(a) |
      +----------+
      | 'a'      |
      | 'a '     |
      | 'a  '    |
      +----------+
      

      It returns a different result set, but it is still wrong.

      With other engines it works as expected:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('a');
      INSERT INTO t1 VALUES ('ã');
      INSERT INTO t1 VALUES ('a ');
      INSERT INTO t1 VALUES ('ã ');
      INSERT INTO t1 VALUES ('a  ');
      INSERT INTO t1 VALUES ('ã  ');
      SELECT quote(a) FROM t1 WHERE a<='a  ';
      

      +----------+
      | quote(a) |
      +----------+
      | 'a'      |
      | 'ã'      |
      | 'a '     |
      | 'ã '     |
      | 'a  '    |
      | 'ã  '    |
      +----------+
      

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(4) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('a');
      INSERT INTO t1 VALUES ('ã');
      INSERT INTO t1 VALUES ('a ');
      INSERT INTO t1 VALUES ('ã ');
      INSERT INTO t1 VALUES ('a  ');
      INSERT INTO t1 VALUES ('ã  ');
      SELECT quote(a) FROM t1 WHERE a<='a  ';
      

      +----------+
      | quote(a) |
      +----------+
      | 'a'      |
      | 'ã'      |
      | 'a '     |
      | 'ã '     |
      | 'a  '    |
      | 'ã  '    |
      +----------+
      

      Attachments

        Issue Links

          Activity

            People

              dleeyh Daniel Lee (Inactive)
              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.