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

DATE_TRUNC_STR returns wrong result

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 7.1.0
    • 7.1.0
    • query
    • None
    • 7.1.0-2434
    • Untriaged
    • 1
    • Yes

    Description

      Looks like date_trunc_str is broken in 7.1.0. Not sure when was introduced.

      on 7.1.0-2434, wrong result:

       cbq> SELECT DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'day') as day, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'week') as week, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'month') as month, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'year') as year;
      {
          "requestID": "e4fff982-3625-4609-bd7a-82961a172d6e",
          "signature": {
              "day": "string",
              "month": "string",
              "week": "string",
              "year": "string"
          },
          "results": [
          {
              "day": "0001-01-01T00:00:00Z",
              "month": "0001-01-01T00:00:00Z",
              "week": "0000-12-31T00:00:00Z",
              "year": "0001-01-01T00:00:00Z"
          }
      

      on 7.1.0-1009, works as expected:

      cbq> SELECT DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'day') as day, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'week') as week, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'month') as month, DATE_TRUNC_STR('2016-05-18T03:59:00Z', 'year') as year;
      {
          "requestID": "2eed035d-44be-4075-9029-3658869bd43b",
          "signature": {
              "day": "string",
              "month": "string",
              "week": "string",
              "year": "string"
          },
          "results": [
          {
              "day": "2016-05-18T00:00:00Z",
              "month": "2016-05-01T00:00:00Z",
              "week": "2016-05-15T03:59:00Z",
              "year": "2016-01-01T00:00:00Z"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "3.346546ms",
              "executionTime": "3.044645ms",
              "resultCount": 1,
              "resultSize": 166,
              "serviceLoad": 6
          }
      }
       

      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
              pierre.regazzoni Pierre Regazzoni
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty