Function MILLIS_TO_TZ in Couchbase docker CE 5.0.1 build 5003 not working well

query
n1ql

#1

Hi,

I’m using function "MILLIS_TO_ZONE_NAME() " in couchbase 4.5. But now I want upgrade my couchbase to Community Edition 5.0.1 build 5003. Problem is that function, that was working well in couchbase 4.5, now have problem. Function executed with status success, but result is null. I did some experiments with this function and I detect a bug. Function work well, when argument tz have value UTC, but any other values of tz cause that result is null. In documentation is example with tz argument (‘America/New_York’, ‘Asia/Kolkata’, ‘UTC’). Just one example is running well, that one where tz value is ‘UTC’. I found nothing to this bug, so I want ask you, if I write something wrong or it is bug. And what I must do, if I want use this function.

Here is example, that I’m running:

“SELECT MILLIS_TO_TZ(1463284740000, ‘America/New_York’) as zonetime”

And result is:

[
{
“zonetime”: null
}
]


#2

seems to work fine. Try with latest version

  SELECT MILLIS_TO_TZ(1463284740000, "America/New_York") as zonetime;
    {
        "requestID": "01c7841c-7570-43af-a2f3-d1f403859b35",
        "signature": {
            "zonetime": "string"
        },
        "results": [
            {
                "zonetime": "2016-05-14T23:59:00-04:00"
            }
        ],
        "status": "success",
        "metrics": {
            "elapsedTime": "21.941411ms",
            "executionTime": "21.919366ms",
            "resultCount": 1,
            "resultSize": 63
        }
    }

#3

It’s possible that I must set something during install? I have couchbase in docker so is something what I must setup?


#4

It should not impact this.


#5

@vsr1 so I really don’t know, what is problem, because on dockerhub is latest version of community version Couchbase 5.0.1 and this version I use.


#6

@tomas.harin I have opened a bug for this. Looks like there is an issue with the docker images: https://issues.couchbase.com/browse/MB-29814


#7

Docker image may not have timezone info database as described in https://golang.org/pkg/time/#LoadLocationFromTZData


#8

@tomas.harin you can fix the issue by going into the docker image with: docker exec -it container_id /bin/bash then apt-get update and apt-get install tzdata. I did this with a fresh docker image and the query works fine.


#9

@korriganclark thank you, this solution works great.