Search Postgresql Archives

Re: ALTER TABLE with USING clause for timestamp

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

 



Josh Trutwin <josh@xxxxxxxxxxxxxxxxxxx> writes:
> I have a column in a table defined as type TEXT and I'd like to
> convert to a TIME type - I tried this:
> ALTER TABLE t1 ALTER COLUMN tcol TYPE TIME WITHOUT TIME ZONE;
> which throws:
> ERROR:  column "tcol" cannot be cast to type "pg_catalog.time"

You just need to cast it explicitly --- to prevent surprises, ALTER
COLUMN TYPE won't implicitly do anything there's no implicit cast for.

ALTER TABLE t1 ALTER COLUMN tcol TYPE TIME USING tcol::TIME;

			regards, tom lane

-- 
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