【发布时间】:2021-12-07 10:41:00
【问题描述】:
我正在尝试创建一个表,其中包含一个名为 decay_date 的列,该列将具有空值(暂时),但会被格式化为具有时区数据类型的时间戳。如果我只是这样做:
CREATE TABLE my_schema.final_summed_table AS
SELECT
'Unstudied' AS table_name,
r.region,
r.state,
r.co_fips,
c.co_name AS county,
'TIER 0' AS tiermetric_lfd,
'UNASSESSED' AS val_combine_lfd,
'Unmapped' AS mod_unmod_lfd,
'' AS det_approx_lfd,
'' AS decay_date_lfd TYPE TIMESTAMP WITH TIME ZONE NULL USING decay_date_lfd::TIMESTAMP
FROM my_schema.unmapped r, cnms.counties c
WHERE r.co_fips = c.co_fips
我收到一个错误:Syntax error near 'TYPE' 此表稍后将与另一个表合并,该表具有相同的 decay_date 列,数据类型为时间戳和时区。创建表时如何为decay_date 列设置时间戳数据类型?
【问题讨论】:
-
null::timestamptz AS decay_date_lfd
标签: postgresql timestamp sqldatatypes