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

Inconsistent evaluation of SOME predicate involving MOD() and BLOB implicit conversion

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 11.4.11
    • N/A
    • Optimizer
    • None
    • MariaDB version: 11.4.11-MariaDB-ubu2404
      Docker image: mariadb:11.4
      Host OS: Windows 11
      Runtime environment: Docker Desktop with WSL2 backend
    • Not for Release Notes

    Description

      When a SOME quantified comparison uses a MOD() expression over BLOB values, the predicate may be evaluated inconsistently between WHERE filtering and SELECT expression evaluation.

      In this case, MOD() evaluates to 0 for one row and NULL for another row due to implicit numeric conversion of BLOB values. The WHERE query returns a different result from the SELECT expression evaluation, although both queries use the same predicate.

      CREATE TABLE t218 (c1 MEDIUMBLOB);
      INSERT INTO t218 SET c1 = '8gaXJD8Gca8shgWnb';
      INSERT INTO t218 (c1) VALUES ('TU32W5lblPm');
      SELECT ta1.ca2 FROM (SELECT t218.c1 AS ca1, t218.c1 AS ca2 FROM t218) AS ta1 WHERE (MOD(ta1.ca1, ta1.ca2) < SOME (SELECT ta4.ca3 FROM (SELECT t218.c1 AS ca3 FROM t218) AS ta4));
      --empty set
      SELECT SUM(count) FROM (SELECT (MOD(ta1.ca1, ta1.ca2) < SOME (SELECT ta4.ca3 FROM (SELECT t218.c1 AS ca3 FROM t218) AS ta4)) IS TRUE AS count FROM (SELECT t218.c1 AS ca1, t218.c1 AS ca2 FROM t218) AS ta1) AS ta_norec;
      --1
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ss Songsong Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.