Saurabh Agrawal, 20.04.2011 08:38:
Hi All,

I am trying to alter column from "timestamp without timezone" to
"bigint" but getting below error:

#ALTER TABLE test ALTER column time type bigint;
#ERROR:  column "time" cannot be cast to type bigint

Is there any other method for alter column to bigint.


This should do it:

ALTER TABLE test ALTER column time type bigint USING extract(epoch from time)

(Btw: I would avoid column names that are keywords like "time")

Thomas



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

Reply via email to