Re: BUG #1537: alter table statement

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: BUG #1537: alter table statement
Дата
Msg-id 20050314115805.GA20480@winnie.fuhr.org
обсуждение исходный текст
Ответ на BUG #1537: alter table statement  ("biju" <biju@analytica-india.com>)
Список pgsql-bugs
On Mon, Mar 14, 2005 at 01:20:06PM +0530, Biju wrote:

> I am using postgresql version 7.2.2

As Tom observed, you might be reading documentation for a later
version and are trying to do something that 7.2 doesn't support.
Here's a link to the 7.2 documentation:

http://www.postgresql.org/docs/7.2/interactive/index.html
http://www.postgresql.org/docs/7.2/interactive/sql-altertable.html

> I tried to conver the datatype of a field in a table say test. and the test
> table say contains
> one field testid of integer. I wanted it to convert it to say date datatype.
> so i gave the query : alter table test alter testid date;

The ability to change a column's type with ALTER TABLE was added
in 8.0 (even so, the syntax you show is incorrect).  Since you're
using 7.2, you'll have to use the method mentioned in the FAQ:

http://www.postgresql.org/docs/faqs.FAQ.html#4.3

However, you won't be able to cast the integer column directly to
date, so you'll have to use an expression that performs the desired
conversion.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Andre Maasikas
Дата:
Сообщение: Re: CC Date format code defaults to current centry
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #1542: pg_dump seg fault