Thread: BUG #1537: alter table statement
The following bug has been logged online: Bug reference: 1537 Logged by: biju Email address: biju@analytica-india.com PostgreSQL version: 7.2.2 Operating system: linux-gnu Description: alter table statement Details: i tried to execute alter table statement for a particular table. i did it many ways, but not worked. i tried with the same syntax given in the postgresql manual but in vain.... can u suggest anything abt this... Thanks
On Fri, Mar 11, 2005 at 11:12:07AM +0000, biju wrote: > PostgreSQL version: 7.2.2 This version is pretty old -- if you must use 7.2, then consider upgrading to 7.2.7. Better yet, try a newer release like 8.0.1. > i tried to execute alter table statement for a particular table. i did it > many ways, but not worked. Please show the exact statement you executed and describe how it didn't work. If you got an error message, then please copy and paste it verbatim. Without more information we can't tell you what's wrong. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
Michael Fuhr <mike@fuhr.org> writes: > On Fri, Mar 11, 2005 at 11:12:07AM +0000, biju wrote: >> i tried to execute alter table statement for a particular table. i did it >> many ways, but not worked. > Please show the exact statement you executed and describe how it > didn't work. If you got an error message, then please copy and > paste it verbatim. Without more information we can't tell you > what's wrong. I'll make a side bet that he's reading post-7.2 documentation and expecting every feature therein to be in 7.2 ... regards, tom lane
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/