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

Wrong result for predicate involving invalid DATETIME conversion and BLOB arithmetic

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.4, 11.8, 12.3, 11.4.11
    • 10.11, 11.4, 11.8, 12.3
    • Data types, Optimizer
    • MariaDB version: 11.4.11-MariaDB-ubu2404
      Docker image: mariadb:11.4
      Host OS: Windows 11
      Runtime environment: Docker Desktop with WSL2 backend

    Description

      A predicate involving an invalid DATETIME conversion and arithmetic with a BLOB value is evaluated inconsistently between WHERE filtering and SELECT expression evaluation.

      The WHERE clause returns one row, while evaluating the same expression as a SELECT expression indicates that no row satisfies the condition.

      CREATE TABLE t35 (c1 BLOB NULL);
      INSERT INTO t35 (c1) VALUES ('8');
      SELECT t35.c1 FROM t35 LEFT JOIN t35 AS ta1 ON 1 WHERE (CONVERT('z', DATETIME) - t35.c1);
      --1 row
      SELECT SUM(count) FROM (SELECT (CONVERT('z', DATETIME) - t35.c1) IS TRUE AS count FROM t35 LEFT JOIN t35 AS ta1 ON 1) AS ta_norec;
      --0
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              ss Songsong 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.