Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-22551

N1QL date/time functions' format arguments don't take generic format strings

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 7.1.0
    • 4.6.0
    • query

    Description

      The format argument of the date/time functions should:

        - accept generic format strings such as "yyyy-mm-dd" or "hh:mm:ss" etc. Currently it only accepts numeric format string with valid values for hour/min/sec. Invalid values, or generic templated string such as "hh:mm:ss" is silently ignored and full date/time string is returned.

        - error cases for valid args should be properly defined and checked, and should return appropriate errors, instead of silently ignoring invalid formats.

       

      For example: 

      1) this works as expected (as numbered format strings with valid values for hr/min/sec)

      SELECT clock_utc("23:56:00");

      {
      "$1": "06:02:23.785"
      }

      2) this doesn't work as expected (as format string is generic text). 

      SELECT clock_utc("hh:mm:ss");

      {
      "$1": "2017-01-31T06:01:14.422Z"
      }

      3) this doesn't work as expected (as format string has invalid hour value 25). 

      SELECT clock_utc("25:56:00");

      {
      "$1": "2017-01-31T06:02:33.131Z"
      }

       

      Similar behavior is observed with CLOCK_STR/CLOCK_LOCAL([fmt]) also . You may want to check other functions that accept format as argument.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              isha Isha Kandaswamy (Inactive)
              Prasad.Varakur Prasad Varakur
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty