Received: from localhost (IDENT:root@hectic-2.jpl.nasa.gov [128.149.68.204]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA65673 for ; Tue, 31 Aug 1999 10:22:34 -0400 (EDT) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1]) by localhost (8.8.7/8.8.7) with ESMTP id OAA14669; Tue, 31 Aug 1999 14:21:54 GMT Sender: lockhart@hub.org Message-ID: <37CBE501.6BC68052@alumni.caltech.edu> Date: Tue, 31 Aug 1999 14:21:53 +0000 From: Thomas Lockhart X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: t-ishii@sra.co.jp, robertC@opmr.com CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] How do I drop a column from a table? References: <199908311359.WAA00554@ext04.sra.co.jp> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > Adding columns is directly supported. Removing columns, or redefining > > them, is done with a CREATE TABLE AS/DROP TABLE/CREATE TABLE AS/DROP > > TABLE sequence, where you write the columns you want to retain into a > > temporary table, delete the original table, and then do the same back > > into a new table with the same name as the original. > But this method might lose some characteristics such as primary key, > unique constraints, no? OK, then CREATE TABLE AS/DROP TABLE/CREATE TABLE/INSERT/DROP TABLE, where the CREATE TABLE can include all relevant characteristics. btw, Tatsuo reminds me that if you have a SERIAL type, you will need to retain the underlying sequence which supports it, define the column in the new table as an INT, and define the DEFAULT clause for it to reference the sequence explicitly. - Thomas -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California