Received: from megazone.bigpanda.com ([63.150.15.178]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fB3JGEm15942 for ; Mon, 3 Dec 2001 14:16:18 -0500 (EST) (envelope-from sszabo@megazone23.bigpanda.com) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id DE18CD5E6; Mon, 3 Dec 2001 11:16:14 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id D3CA55BEA; Mon, 3 Dec 2001 11:16:14 -0800 (PST) Date: Mon, 3 Dec 2001 11:16:14 -0800 (PST) From: Stephan Szabo To: Ligia Pimentel Cc: Subject: Re: An easy question about creating a primary key In-Reply-To: <9u6gco$7fb$1@news.tht.net> Message-ID: <20011203111257.H93680-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200112/27 X-Sequence-Number: 5850 On Thu, 29 Nov 2001, Ligia Pimentel wrote: > Hello. > > I'm using postgres 7.1. I have an easy question... > > I want to create a primary key constraint on an existing table. The > documentation says I can't . Please confirm. If this is true... How can I > rename the existing table so I can create the new one and copy the data? I believe that's correct for 7.1 at least. You can rename tables using ALTER TABLE (alter table rename to ). If the column(s) are marked not null already, you may be able to just get away with creating a unique index on the column(s) named "
_pkey"