-->

redshift convert_timezone does not work

2019-09-07 02:02发布

问题:

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.