Re: changing column datatype from char(20) to timestamp

Поиск
Список
Период
Сортировка
Искать
От
Lonni J Friedman
Тема
Re: changing column datatype from char(20) to timestamp
Дата
Msg-id
7c1574a90804291326i529f4e8bt595973477b819cee@mail.gmail.com
Ответ на
Список
Дерево обсуждения
changing column datatype from char(20) to timestamp "Lonni J Friedman" <netllama@gmail.com>
Re: changing column datatype from char(20) to timestamp Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: changing column datatype from char(20) to timestamp Tom Lane <tgl@sss.pgh.pa.us>
Re: changing column datatype from char(20) to timestamp "Lonni J Friedman" <netllama@gmail.com>
On Tue, Apr 29, 2008 at 10:46 AM, Tom Lane  wrote:
> "Lonni J Friedman"  writes:
>  > Unfortunately, I can't just do:
>  > ALTER TABLE data ALTER COLUMN date_created TYPE timestamp ;
>
>  > since the data is currently in this format:
>  > 04-29-2008 10:03:28
>
>  I think you're just missing an explicit cast:
>
>  ALTER TABLE data ALTER COLUMN date_created TYPE timestamp USING date_created::timestamp;
>
>  You should first check that datestyle is set to MDY to avoid
>  any confusion about the field order, but other than that I don't
>  see why you'd have a format problem.

Excellent, that worked perfectly.  thanks!


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman netllama@gmail.com
LlamaLand https://netllama.linux-sxs.org
В списке pgsql-novice по дате отправления
От: Bruce Hyatt
Дата:
От: Phillip Smith
Дата:
FAQ