Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31719

Wrong result of: WHERE inet6_column IN ('','::1')

Details

    Description

      This script erroneously treats '' as a correct INET6 value of '::' and returns one row:

      CREATE OR REPLACE TABLE t1 (a INET6);
      INSERT INTO t1 VALUES ('::');
      SELECT * FROM t1 WHERE a IN ('','::1');
      

      +------+
      | a    |
      +------+
      | ::   |
      +------+
      1 row in set, 1 warning (0.000 sec)
      

      The comparison operator works as expected on the contrary:

      SELECT * FROM t1 WHERE a='';
      

      Empty set, 2 warnings (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            The same problem is repeatable with UUID stating from 10.9.

            The IN operator returns a wrong row:

            CREATE OR REPLACE TABLE t1 (a UUID);
            INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
            SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001');
            

            +--------------------------------------+
            | a                                    |
            +--------------------------------------+
            | 00000000-0000-0000-0000-000000000000 |
            +--------------------------------------+
            

            The comparison operator works fine:

            SELECT * FROM t1 WHERE a='';
            

            Empty set, 2 warnings (0.001 sec)
            

            bar Alexander Barkov added a comment - The same problem is repeatable with UUID stating from 10.9. The IN operator returns a wrong row: CREATE OR REPLACE TABLE t1 (a UUID); INSERT INTO t1 VALUES ( '00000000-0000-0000-0000-000000000000' ); SELECT * FROM t1 WHERE a IN ( '' , '00000000-0000-0000-0000-000000000001' ); +--------------------------------------+ | a | +--------------------------------------+ | 00000000-0000-0000-0000-000000000000 | +--------------------------------------+ The comparison operator works fine: SELECT * FROM t1 WHERE a= '' ; Empty set, 2 warnings (0.001 sec)

            Pushed to 10.5 in a single patch with MDEV-27207.
            Waiting for a merge to 10.9 to add UUID tests.

            bar Alexander Barkov added a comment - Pushed to 10.5 in a single patch with MDEV-27207 . Waiting for a merge to 10.9 to add UUID tests.

            The merge 10.5->10.6 for this patch went wrong.
            Pushed an after-merge cleanup:
            https://github.com/MariaDB/server/commit/88dd50b80ad9624d05b72751fd6e4a2cfdb6a3fe

            Waiting for it to propagate to 10.9.

            bar Alexander Barkov added a comment - The merge 10.5->10.6 for this patch went wrong. Pushed an after-merge cleanup: https://github.com/MariaDB/server/commit/88dd50b80ad9624d05b72751fd6e4a2cfdb6a3fe Waiting for it to propagate to 10.9.

            People

              bar Alexander Barkov
              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.