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

CURTIME, UTC_TIME and UTC_TIMESTAMP accept precision 65536 as zero

    XMLWordPrintable

Details

    Description

      MariaDB accepts an explicitly requested fractional-seconds precision of 65536 for CURTIME(), UTC_TIME() and UTC_TIMESTAMP(). The functions return values with zero fractional digits instead of rejecting the precision with ER_TOO_BIG_PRECISION (1426).

      Steps to reproduce

      1. Connect to MariaDB 12.3.3.
      2. Execute each statement separately, in the following order:

      SELECT OCTET_LENGTH(CURTIME(65536)) AS curtime_length;
      SELECT OCTET_LENGTH(UTC_TIME(65536)) AS utc_time_length;
      SELECT OCTET_LENGTH(UTC_TIMESTAMP(65536)) AS utc_timestamp_length;
      SELECT OCTET_LENGTH(CURTIME(6)) AS valid_length;
      SELECT CURTIME(7) AS invalid_precision;
      SELECT CAST('12:34:56' AS TIME(65536)) AS cast_precision;

      These statements are read-only and require no setup.

      Actual result

      The first three statements succeed:

      curtime_length
      8
       
      utc_time_length
      8
       
      utc_timestamp_length
      19

      The valid CURTIME(6) control succeeds and returns a length of 15. The two rejection controls produce the expected errors:

      ERROR 1426 (42000): Too big precision specified for 'curtime'. Maximum is 6
      ERROR 1426 (42000): Too big precision specified for '12:34:56'. Maximum is 6

      Expected result

      Each explicitly requested temporal fractional precision greater than 6 should be rejected with ER_TOO_BIG_PRECISION (1426). In particular, precision 65536 should not be accepted as a zero-fractional-precision value.

      The differing treatment of 7 and 65536 indicates that the full-width precision is not preserved through validation for these temporal functions, while the TIME cast correctly rejects 65536.

      This occurs when CURTIME, UTC_TIME or UTC_TIMESTAMP is given the exceptional precision value 65536.

      Attachments

        Issue Links

          Activity

            People

              raghunandan.bhat Raghunandan Bhat
              Milo liu
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.