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

A misleading warning message from the DELETE statement

    XMLWordPrintable

Details

    Description

      I try the following statements in MariaDB 10.8.2 with strict SQL mode.

      DROP TABLE IF EXISTS t0;
      CREATE TABLE t0(c0 INT);
      INSERT INTO t0 VALUES (1);
      DELETE FROM t0 WHERE IFNULL((-1) | (-1), 0);
      SHOW WARNINGS;
      

      The DELETE statement succeeded, but a warning message is generated as following:

      mysql> SHOW WARNINGS;
      +---------+------+-----------------------------------------------------------------------------+
      | Level   | Code | Message                                                                     |
      +---------+------+-----------------------------------------------------------------------------+
      | Warning | 1916 | Got overflow when converting '18446744073709551615' to INT. Value truncated |
      +---------+------+-----------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      I think there should be no warnings. Otherwise, this truncate warning should make the DELETE statement fail in strict SQL mode. Moreover, I try the same WHERE clause in the UPDATE statement, where the UPDATE statement succeeded without warnings.

      DROP TABLE IF EXISTS t0;
      CREATE TABLE t0(c0 INT);
      INSERT INTO t0 VALUES (1);
      UPDATE t0 SET c0 = 2 WHERE IFNULL((-1) | (-1), 0);
      SHOW WARNINGS;
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              John Jove John Jove
              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.