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

Unexpected error on `WHERE inet6col`

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.6, 11.5(EOL)
    • 11.8.1
    • Optimizer
    • None

    Description

      This script:

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

      produces the following output:

      +------+
      | a    |
      +------+
      | ::1  |
      +------+
      

      Looks good so far.

      Now if I run:

      SELECT * FROM t1 WHERE a;
      

      it returns an unexpected error:

      ERROR 4078 (HY000): Illegal parameter data types inet6 and bigint for operation '<>'
      

      The problem is that the condition:

      WHERE column
      

      gets rewritten by the parser into:

      WHERE column<>0
      

      which is not applicable in case of INET6.

      It should probably be rewritten to:

      WHERE column IS TRUE
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov added a comment - Sanja , please review the patch: https://github.com/MariaDB/server/commit/a24f897d683c61fa400be8b9536888b0777c2b71

            All look good but want to inform optimiser team on tomorrow call

            sanja Oleksandr Byelkin added a comment - All look good but want to inform optimiser team on tomorrow call

            Updated the patch to 11.8, as agreed during the optimizer team call.

            bar Alexander Barkov added a comment - Updated the patch to 11.8, as agreed during the optimizer team call.
            bar Alexander Barkov added a comment - - edited Ported the patch to 11.8: https://github.com/MariaDB/server/commit/3ddcc8477dfc9d2b3a0122c4896cdd91bae1e25f psergei , please review.

            The patch looks good to me

            psergei Sergei Petrunia added a comment - The patch looks good to me

            I force-pushed a newer version of the patch. Please find it here:

            https://github.com/MariaDB/server/tree/bb-11.8-bar-MDEV-34189

            bar Alexander Barkov added a comment - I force-pushed a newer version of the patch. Please find it here: https://github.com/MariaDB/server/tree/bb-11.8-bar-MDEV-34189

            Testing done, OK to push

            lstartseva Lena Startseva added a comment - Testing done, OK to push

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.