Received: from yuubin.games.no (yuubin.link.no [193.213.36.89]) by hub.org (8.8.8/8.7.5) with ESMTP id LAA02812 for ; Thu, 16 Jul 1998 11:58:23 -0400 (EDT) Received: from sleeper.games.no (pere@sleeper.link.no [193.213.36.74]) by yuubin.games.no (8.8.7/8.8.7) with ESMTP id RAA11231; Thu, 16 Jul 1998 17:57:08 +0200 Received: (from pere@localhost) by sleeper.games.no (8.8.7/8.8.7) id RAA28247; Thu, 16 Jul 1998 17:57:06 +0200 Date: Thu, 16 Jul 1998 17:57:06 +0200 Message-Id: <199807161557.RAA28247@sleeper.games.no> To: pgsql-sql@postgresql.org Subject: Change attribute type From: Petter Reinholdtsen Reply-to: pere@hungry.com How do I change an attributes type, or how do I remove an attribute from a table. I have a table created with this command: create table test(data int4, changed timestamp); I want to have this table instead: create table test(data int4, changed datetime); I have lots of entries in the table, and want too keep them when I change the date type. The simple method would be to change the type. Is it possible? The hard method requires the possibility of removing an attribute. 1 change name of the attribute 'alter table test rename column changed to changedold;' 2 create new attribute 'alter table test add changed datetime;' 3 insert old data in new attribute 'update test set changed = changedold;' 4 remove the old attribute ? Any clues? BTW: As I don't follow this mailing-list, could you please send me a copy when replying? -- ##> Petter Reinholdtsen <## | pere@td.org.uit.no O- http://www.hungry.com/~pere/ | Go Mozilla, go! Go!