Skip site navigation (1) Skip section navigation (2)

Re: BUG #1537: alter table statement

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Biju <biju(at)analytica-india(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1537: alter table statement
Date: 2005-03-14 11:58:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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:

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

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

Michael Fuhr

In response to

pgsql-bugs by date

Next:From: Manfred KoizarDate: 2005-03-14 12:40:38
Subject: Re: [HACKERS] We are not following the spec for HAVING without GROUP
Previous:From: Ales VojacekDate: 2005-03-14 11:55:09
Subject: BUG #1543: Problem with restore DB

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group