Received: from gw.reaumur.absolight.net (gw.reaumur.absolight.net [212.43.217.57]) by postgresql.org (Postfix) with ESMTP id A21494759C5 for ; Thu, 25 Jul 2002 12:55:40 -0400 (EDT) Received: from andromede.reaumur.absolight.net (andromede.reaumur.absolight.net [212.43.217.61]) by gw.reaumur.absolight.net (Postfix) with ESMTP id 883B71BEAB2; Thu, 25 Jul 2002 18:55:43 +0200 (CEST) Date: Thu, 25 Jul 2002 18:55:41 +0200 From: Mathieu Arnold To: Raphael Bauduin , pgsql-admin@postgresql.org Subject: Re: CREATE TABLE AS ... Message-ID: <30470183.1027623340@andromede.reaumur.absolight.net> In-Reply-To: <20020723134807.GB22069@raphael> References: <20020723134807.GB22069@raphael> X-Mailer: Mulberry/3.0.0a3 (Win32) X-wazaaa: True, true MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Archive-Number: 200207/360 X-Sequence-Number: 5044 --On mardi 23 juillet 2002 15:48 +0200 Raphael Bauduin wrote: > Hi, > > In a data model change, I wanted to use the "create table as select" > feature. However, I want that table to have a primary key defined, and > thus a field defined as NOT NULL. I didn't find a way to add a NOT NULL > constraint on a column of an existing table. If there isn't, what's the > best way to go? A COPY? why not just : create table new_table (new fields with all you need); insert into new_table ; -- Mathieu Arnold