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

Condition is evaluated on an empty table

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.2(EOL)
    • 10.2(EOL)
    • None
    • None
    • 10.2.7-1

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
      SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
      SHOW WARNINGS;
      

      +---------+------+---------------+
      | Level   | Code | Message       |
      +---------+------+---------------+
      | Warning | 1365 | Division by 0 |
      +---------+------+---------------+
      

      Notice, the IN predicate is evaluated on an empty table. Looks wrong. The record buffer is not initialized to any valid data in case of an empty table, so calling Item_field::val_xxx() is not correct.

      Note, if I change ENGINE from MYISAM to InnoDB, the warning goes away.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.