
create table a(t timestamp without time zone,t2 timestamp with time zone);insert into a(t) values ('2012-03-01'::timestamp);update a set t2 = t;select * from a; t | t2 ---------------------+------------------------ 2012-03-01 00:00:00 | 2012-03-01 00:00:00-08alter table a alter column t type timestamp with time zone;select * from a; t | t2 ------------------------+------------------------ 2012-03-01 00:00:00-08 | 2012-03-01 00:00:00-08 根据Alter Table手册:
if [the USING clause is] omitted,the default conversion is the same as an assignment cast from old data type to new.
根据Date/Time types手册
总结Conversions between timestamp without time zone and timestamp with time zone normally assume that the timestamp without time zone value should be taken or given as timezone local time. A different time zone can be specifIEd for the conversion using
AT TIME ZONE.
以上是内存溢出为你收集整理的PostgreSQL alter type timestamp without time zone – > with time zone全部内容,希望文章能够帮你解决PostgreSQL alter type timestamp without time zone – > with time zone所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)