Re: Changing the type of timestamp columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing the type of timestamp columns
Date: 2004-08-09 14:32:54
Message-ID: 14512.1092061974@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Is it safe to update the atttypid of a timestamp column to be a
> timestamptz column?

For sufficiently small values of "safe", sure.

The problem is that unless you live in GMT zone, the interpretation
of values is different: the zero reference for timestamptz is midnight
GMT 2000-01-01, whereas for timestamp it's midnight your local time
2000-01-01. So if you do the above, all the stored timestamps will
appear to change value by your offset from GMT.

If you're planning to replace all the column entries then it won't
matter, but ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-09 14:33:43 Re: Analyze using savepoints?
Previous Message Tom Lane 2004-08-09 14:25:55 Re: SRFs ExecMakeTableFunctionResult