PostgreSQL ALTER COLUMN TYPE with time zone -> timestamp without time zone
CREATE TABLE public.sampletable(d timestamp(0) with time zone);
INSERT into sampletable VALUES('2013-04-18 13:00');
SELECT * FROM sampletable
ALTER TABLE sampletable
ALTER COLUMN d TYPE timestamp(0) without time zone
USING d AT TIME ZONE '-9:00:00';
INSERT into sampletable VALUES('2013-04-18 13:00');
SELECT * FROM sampletable
d timestampe(0) with time zone
---------------------------
"2013-04-18 13:00:00+09"
ALTER TABLE sampletable
ALTER COLUMN d TYPE timestamp(0) without time zone
USING d AT TIME ZONE '-9:00:00';
About '-9:00:00' :SELECT * FROM sampletable
Select -1 * (current_timestamp - current_timestamp AT TIME ZONE 'UTC') As TimeZoneOffSet
d timestampe(0) with time zone
---------------------------
"2013-04-18 13:00:00"
コメント
コメントを投稿