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

Incorrect query result may caused by COT funciton

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.0.15, 11.4.1
    • None
    • Optimizer
    • None
    • Ubuntu 22.04 CLI

    Description

      Description

      Dear devps, Our fuzzer may found a bug.

      Consider the following statements, qeury1 and query2 should reutrn the same reuslt. However, qeury1 return 1 while query2 return nothing.

      -- query1
      mysql> SELECT (t1.c0) AS _c0 FROM t0, t1 WHERE COT(t0.c0);
      Empty set (0.00 sec)
       
      --query2
      mysql> SELECT _c0 FROM (SELECT (t1.c0) AS _c0, (COT(t0.c0)) IS TRUE AS flag FROM t0, t1) AS t WHERE flag=1;
      +------+
      | _c0  |
      +------+
      | 1    |
      +------+
      1 row in set (0.00 sec)
      

      How to repeat

      The bug can be reproduced from from 10.0.15 to 11.4.1

      CREATE TABLE t0(c0 BIGINT);
      CREATE OR REPLACE TABLE t1(c0 VARCHAR(100));
      INSERT INTO t0 VALUES (-1838284247);
      INSERT INTO t1 VALUES ('1');
       
      SELECT (t1.c0) AS _c0 FROM t0, t1 WHERE COT(t0.c0);
      SELECT _c0 FROM (SELECT (t1.c0) AS _c0, (COT(t0.c0)) IS TRUE AS flag FROM t0, t1) AS t WHERE flag=1;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Shiyang Ye Shiyang Ye
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.