如何更改 Amazon Redshift 中的默认时区?
How to change the default timezone in Amazon Redshift?
默认将时间戳列设置为 SYSDATE,将其存储为 UTC。是否可以更改时区以便 SYSDATE 将日期和时间存储到不同的时区?
到目前为止,我已经检查了 SET 命令,但我不确定是否可以使用它来更改时区。
基本上,答案是否定的。根据 documentation:
TIMESTAMP values are UTC, not local time, in both user tables and
Amazon Redshift system tables.
Note Timestamps with time zones are not supported.
如果您需要查询 return 不同时区的数据,您可以使用 CONVERT_TIMEZONE 函数,使用常量时区值(或查询参数),或将结果加入配置table 其中包含所需的时区。
默认将时间戳列设置为 SYSDATE,将其存储为 UTC。是否可以更改时区以便 SYSDATE 将日期和时间存储到不同的时区?
到目前为止,我已经检查了 SET 命令,但我不确定是否可以使用它来更改时区。
基本上,答案是否定的。根据 documentation:
TIMESTAMP values are UTC, not local time, in both user tables and Amazon Redshift system tables.
Note Timestamps with time zones are not supported.
如果您需要查询 return 不同时区的数据,您可以使用 CONVERT_TIMEZONE 函数,使用常量时区值(或查询参数),或将结果加入配置table 其中包含所需的时区。