Re: Alter column

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Alter column
Дата
Msg-id 20060814121232.GA62876@winnie.fuhr.org
обсуждение исходный текст
Ответ на Alter column  (Mike Ellsworth <nhrcommu@rochester.rr.com>)
Список pgsql-novice
On Mon, Aug 14, 2006 at 08:00:59AM -0400, Mike Ellsworth wrote:
> Is there a way to convert data type `datetime` into an integer

There is no datetime type.  Do you mean timestamp or timestamp with
time zone?

> (unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
> USING CAST(`column_name` as integer) ...... something like this?

Is this what you're looking for?

ALTER TABLE foo ALTER COLUMN column_name TYPE integer
  USING extract(epoch FROM column_name);

--
Michael Fuhr

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

Предыдущее
От: Christoph Frick
Дата:
Сообщение: Re: Alter column
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Alter column