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

Integer overflow when using 9223372036854775808 as a LIMIT parameter

    XMLWordPrintable

Details

    Description

      DELIMITER $$
      BEGIN NOT ATOMIC
        DECLARE a DECIMAL(30,0) DEFAULT 9223372036854775808;
        EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 LIMIT ?' USING a;
      END;
      $$
      DELIMITER ;
      SHOW WARNINGS;
      

      +---------+------+----------------------------------------------------------------------------+
      | Level   | Code | Message                                                                    |
      +---------+------+----------------------------------------------------------------------------+
      | Warning | 1916 | Got overflow when converting '9223372036854775808' to INT. Value truncated |
      | Note    | 1003 | select 1 AS `1` limit 9223372036854775807                                  |
      +---------+------+----------------------------------------------------------------------------+
      

      Notice, the value was truncated to the maximum signed integer. This looks wrong.
      It should treat 9223372036854775808 as an unsigned value and preserve it in the LIMIT clause.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.