redshift convert_timezone不起作用 [英] redshift convert_timezone does not work
问题描述
使用Razor SQL运行Redshift查询时,UTC日期似乎被视为位于本地时区,并带有夏令时.
When running Redshift queries using Razor SQL, UTC dates appear to be treated as being in the local timezone, complete with daylight saving times.
例如,运行
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')
每次返回相同的时间,2016-03-27 03:00
returns the same time for each, 2016-03-27 03:00
纽约实际上在3月13日更改为夏令时,这确实可行:
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')
推荐答案
因此,这证明是Amazon redshift JDBCS驱动程序中的错误.如果您在标准的postgres JDBC驱动程序中运行相同的查询,则效果很好.
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.
这篇关于redshift convert_timezone不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!