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

Different result for logically equivalent queries using STRAIGHT_JOIN and comma join

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.2.1
    • None
    • Optimizer
    • None
    • Ubuntu 24.04 LTS x86_64 docker image mariadb:12.2-rc

    Description

      Run the following statements. The first query returns one row, while the second query returns an empty set.
      The two queries are logically equivalent but produce different result sets depending on the join syntax.

      CREATE TABLE t0 (a INT);
      CREATE TABLE t1 (b REAL ZEROFILL, PRIMARY KEY (b));
       
      INSERT INTO t0 VALUES (1);
      INSERT INTO t1 VALUES (0);
       
      SELECT t0.a, t1.b FROM t0 STRAIGHT_JOIN t1 WHERE ('-1' = (t1.b));
      -- returns 1 row: (1, 0000000000000000000000) 
       
      SELECT t0.a, t1.b FROM t0, t1 WHERE ('-1' = (t1.b));
      -- returns an empty set   
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            asdWang Weipeng Wang
            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.