Search Postgresql Archives

Re: recasting to timestamp from varchar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/4/2013 9:28 AM, Kirk Wythers wrote:
ALTER TABLE sixty_min ALTER COLUMN time2 TYPE timestamp;
ERROR:  column "time2" cannot be cast to type timestamp without time zone

you need to give it some hints as to how to do that casting.

ALTER TABLE sixty_min ALTER COLUMN time2 TYPE timestamp USING to_timestamp(time2, 'YYYY-MM-DD HH24-MI-SS');


I would use timezone with time zone as the type here. Effectively, this type converts all input times to UTC from either the specified or client's default TZ, and converts all time output to either the specified or client's TZ. it behaves properly, while 'timestamp' without timezone doesn't..




--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux