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

Incorrect result in JOIN with IN subquery

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 12.1.2
    • N/A
    • Optimizer
    • None
    • 12.1.2-MariaDB-ubu2404
    • Not for Release Notes

    Description

      When a CHAR column containing a non-numeric string (e.g., 'Kx') is compared against a BIT column via an IN subquery, the server returns rows unexpectedly.

      How to repeat:

      • CREATE TABLE t1(c1 BIT);
        CREATE TABLE t2(c1 CHAR(20));
         
        INSERT INTO t2 (c1) VALUES ('Kx');
        INSERT INTO t1 (c1) VALUES (b'0');
        INSERT INTO t1 (c1) VALUES (b'1');
         
        SELECT t1.c1 FROM t1 JOIN t2 ON (t2.c1 IN (SELECT t1.c1 FROM t1));
        /* Expected: Empty set
           Actual: 
           +------------+
           | c1         |
           +------------+
           | 0x00       |
           | 0x01       |
           +------------+
        */
        

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              March SerenMarch
              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.