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

Unexpected result of IN operator

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Ubuntu 24.04

    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

              Unassigned Unassigned
              ChiZhang Chi Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.