我想更改表以将列的数据类型从numeric更改为timestamp而不使用时区。它有现有数据。我需要注意哪些问题?
答案 0 :(得分:0)
ALTER TABLE <table name>
ALTER COLUMN <column name> type timestamp without time zone
USING to_timestamp(<column name>) AT TIME ZONE 'UTC';
示例:
ALTER TABLE test.numericdates
ALTER COLUMN date type timestamp without time zone
USING to_timestamp(date) AT TIME ZONE 'UTC';