小编Amy*_*Amy的帖子

postgreSQL将列数据类型更改为没有时区的时间戳

我想将一列数据从文本更改为时间戳类型。我的数据中没有时区。我的数据格式类似于28-03-17 17:22,包括时间和日期,但没有时区。换句话说,我所有的数据都在同一时区。我该怎么做?

我在下面尝试了多种方法,但仍然找不到正确的方法。希望您能够帮助我。

当然,如果可以解决我的问题,我可以建立一个新表。

alter table AB
alter create_time type TIMESTAMP;

ERROR:  column "create_time" cannot be cast automatically to type timestamp without time zone
HINT:  You might need to specify "USING create_time::timestamp without time zone".
********** Error **********

ERROR: column "create_time" cannot be cast automatically to type timestamp without time zone
SQL state: 42804
Hint: You might need to specify "USING create_time::timestamp without time zone".
Run Code Online (Sandbox Code Playgroud)
alter table AB
alter create_time type TIMESTAMP without time zone;

ERROR:  column "create_time" cannot be …
Run Code Online (Sandbox Code Playgroud)

sql postgresql timestamp

5
推荐指数
2
解决办法
3万
查看次数

标签 统计

postgresql ×1

sql ×1

timestamp ×1