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

Unexpected result of IN operator

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • None
    • N/A
    • Data types
    • None
    • Ubuntu 24.04
    • Not for Release Notes

    Description

      Hi,

      In the following test case

      CREATE TABLE t0(c0 CHAR(100));
      INSERT INTO t0 VALUES ('A');
      SELECT (('\\6' IS TRUE) NOT IN (t0.c0, CAST(449007834 AS DECIMAL))) FROM t0;
      

      There is only one value `A` in the column c0, so I expected the expression `(('
      6' IS TRUE) NOT IN (t0.c0, CAST(449007834 AS DECIMAL)))` to be true, however, the MariaDB returns `0`

      The equivalent prepared statement can return correct result on this case:

      SET @a = 449007834;
      PREPARE prepare_query FROM "SELECT (('\\6' IS TRUE) NOT IN (t0.c0, CAST(? AS DECIMAL))) FROM t0";
      EXECUTE prepare_query USING @a;
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.