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

INNER JOIN and STRAIGHT_JOIN Return Inconsistent Results

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 10.11, 11.4, 11.8, 12.1, 11.8.3
    • 10.11, 11.4, 11.8, 12.1
    • Optimizer
    • None
    • Windows 11

    Description

      A critical query optimizer issue has been identified in MariaDB 11.8.3 where INNER JOIN and STRAIGHT_JOIN with identical join conditions produce different result sets.

      Expected Behavior

      INNER JOIN and STRAIGHT_JOIN should return the same result set (only the table join order differs; the results should be identical).

      Actual Behavior

      INNER JOIN query returns 0 rows
      STRAIGHT_JOIN query returns 1 row: 314572759|0

      Steps to Reproduce

      -- Create test tables
      CREATE OR REPLACE TABLE t0(c0 VARCHAR(100) UNIQUE PRIMARY KEY);
      CREATE TABLE IF NOT EXISTS t2(c0 REAL UNSIGNED UNIQUE NOT NULL, PRIMARY KEY(c0));
       
      -- Insert test data
      INSERT INTO t0 VALUES ('314572759');
      INSERT INTO t2 VALUES (1804481142);
       
      -- Update operation (critical step)
      UPDATE IGNORE t2 SET c0=-290584934;
       
      -- Query 1: INNER JOIN (returns 0 rows - incorrect)
      SELECT DISTINCT t0.c0, t2.c0 FROM t0 INNER JOIN t2 ON ('-1946386008' IN (t2.c0));
       
      -- Query 2: STRAIGHT_JOIN (returns 1 row - correct)
      SELECT DISTINCT t0.c0, t2.c0 FROM t0 STRAIGHT_JOIN t2 ON ('-1946386008' IN (t2.c0));
      

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            Shiyang Ye Shiyang Ye
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: