Received: from mta5.rcsntx.swbell.net (mta5.rcsntx.swbell.net [151.164.30.29]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f732Ruf00132 for ; Thu, 2 Aug 2001 22:27:56 -0400 (EDT) (envelope-from sdoerr@swbell.net) Received: from swbell.net ([208.191.217.71]) by mta5.rcsntx.swbell.net (Sun Internet Mail Server sims.3.5.2001.05.04.11.50.p10) with ESMTP id <0GHG0044CZO76C@mta5.rcsntx.swbell.net> for pgsql-admin@postgresql.org; Thu, 2 Aug 2001 21:16:56 -0500 (CDT) Date: Thu, 02 Aug 2001 22:37:37 -0500 From: Steve Doerr Subject: Modifying existing tables To: "pgsql-admin@postgresql.org" Message-id: <3B6A1C81.2D9D4E70@swbell.net> MIME-version: 1.0 X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.18pre21 i686) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en X-Archive-Number: 200108/11 X-Sequence-Number: 1942 Is this the only way to add attributes to an existing table, and add unique and a default(for example) to existing attributes? Just wondered if there are alternatives. I didn't really see this in the docs or mailing lists. Thanks for any input. Steve original table: CREATE TABLE table ( attrib1 int, attrib2 int, ); table edit: CREATE TABLE newtable ( attrib1 int UNIQUE, attrib2 int DEFAULT 1, attrib3 int ); INSERT INTO newtable (attrib1, attrib2) SELECT attrib1, attrib2 FROM table; DROP TABLE table; ALTER TABLE newtable RENAME TO table;