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

GREATEST incorrectly checks a fields' datatype during calculations

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.2.14
    • Fix Version/s: N/A
    • Component/s: Data types
    • Labels:
      None
    • Environment:
      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

              Assignee:
              bar Alexander Barkov
              Reporter:
              laxamar Jacques Amar
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: