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

GREATEST incorrectly checks a fields' datatype during calculations

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.2.14
    • N/A
    • Data types
    • None
    • Linux CentOS 7 64 bit

    Description

      If a field is created with :
      fieldname SMALLINT UNSIGNED DEFAULT 0

      Then using

      GREATEST(0, fieldname-1)

      in SELECT or UPDATE
      will trigger an error and not give results
      ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '`db`.`table`.`fieldname` - 1'

      Actual example for SELECT:

      select greatest(1,loc_count-1) from Custom_Lists;
      ERROR 1690 (22003): BIGINT UNSIGNED value is out of range in '`pj_dev`.`Custom_Lists`.`loc_count` - 1'

      same for UPDATE

      The error should only be triggered in a direct field,not using GREATEST()

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              laxamar Jacques Amar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.