redshift convert_timezone does not work

2019-09-07 01:38发布

When running Redshift queries using Razor SQL, UTC dates appear to be treated as being in the local timezone, complete with daylight saving times.

For example, running

SELECT 'first',CONVERT_TIMEZONE('UTC', 'America/New_York', '2016-03-27    06:00:00')
UNION
SELECT 'second', CONVERT_TIMEZONE('UTC', 'America/New_York', '2016-03-27 07:00:00')

returns the same time for each, 2016-03-27 03:00

New York actually changed to daylight saving time on the 13th March and this does work:

SELECT 'first',CONVERT_TIMEZONE('UTC', 'America/New_York', '2016-03-13 06:00:00')
UNION
SELECT 'second', CONVERT_TIMEZONE('UTC', 'America/New_York', '2016-03-13 07:00:00')

1条回答
做自己的国王
2楼-- · 2019-09-07 02:00

So this turned out to be a bug in the amazon redshift JDBCS driver. If you run the same query in the standard postgres JDBC drivers it works just fine.

I haven't had any feedback from Amazon on a possible fix.

查看更多
登录 后发表回答