redshift convert_timezone does not work

半腔热情 提交于 2019-12-11 07:33:11

问题


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:


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.



来源:https://stackoverflow.com/questions/39149524/redshift-convert-timezone-does-not-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!