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

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 -1 * (current_timestamp - current_timestamp AT TIME ZONE 'UTC') As TimeZoneOffSet

SELECT * FROM sampletable

d timestampe(0) with time zone
---------------------------
"2013-04-18 13:00:00"

コメント

このブログの人気の投稿

pip install mojimoji failed

Windows Server 2008 R2 & PHP 5.6(64bit)