Re: ERROR: column "time" cannot be cast to type bigint

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: ERROR: column "time" cannot be cast to type bigint
Дата
Msg-id ioojn2$91i$1@dough.gmane.org
обсуждение исходный текст
Ответ на ERROR: column "time" cannot be cast to type bigint  (Saurabh Agrawal <saurabh.miet@gmail.com>)
Список pgsql-admin
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


В списке pgsql-admin по дате отправления:

Предыдущее
От: Mlondolozi Ncapayi
Дата:
Сообщение: How to uninstall PostgreSQL 8.4 on both Windows XP and Windows 7
Следующее
От: Mario Splivalo
Дата:
Сообщение: Re: Reseting statistics, cluster wide