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

N1QL: Date mutation functions should take into account length of months

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 7.1.0
    • 5.5.6, 6.0.3, 6.5.0
    • query

    Description

      When using date mutation functions, such as DATE_ADD_STR, it normalises the date when adding a month, for example:

      SELECT DATE_ADD_STR('2020-01-31 00:00:00Z', 1, 'month') AS dateFuture
      [
        {
          "dateFuture": "2020-03-02T00:00:00Z"
        }
      ]
      

      This is due to the underlying Go library, as explained here:

      AddDate normalizes its result in the same way that Date does, so, for example, adding one month to October 31 yields December 1, the normalized form for November 31.

      This is not the expected outcome from an end user perspective, we would expect the outcome of the above example to be the 29th February.

      Attachments

        Issue Links

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

          Activity

            People

              pierre.regazzoni Pierre Regazzoni
              tim.bradgate Tim Bradgate (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty