Received: from tidal.ipinc.com (tidal.ipinc.com [199.245.188.85]) by hub.org (8.10.1/8.10.1) with ESMTP id e7U1rdC19571 for ; Tue, 29 Aug 2000 21:53:39 -0400 (EDT) Received: from ipinc.com (jliang.ipinc.com [199.245.188.130]) by tidal.ipinc.com (8.9.3/8.9.3) with ESMTP id SAA54603; Tue, 29 Aug 2000 18:52:40 -0700 (PDT) (envelope-from jliang@ipinc.com) Message-ID: <39AC687D.D38ACA3D@ipinc.com> Date: Tue, 29 Aug 2000 18:50:53 -0700 From: Jie Liang Organization: ipinc.com X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Webb Sprague CC: pgsql-sql@postgresql.org Subject: Re: Create Primary Key? References: <20000830003714.22218.qmail@web803.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200008/335 Hi, It suppose to use ALTER TABLE tablename ADD constraint xxx primary key(columnname), unforturatly, Pg7.0 still haven't implemented it yet, so except foreign key ,other constarints, you have to choose: 1. rename your old table, recreate an new one with primary key, then use insert into newtable select * from oldtable. 2. use pg_dump -t tablename -f scriptfile dbname in shell , edit that scriptfile, add primary key there, drop your table, then reload it again: psql dbname Apropos of my last question: > > Is there syntax to create a primary key after the > table has been defined and populated? I think I could > speed things up quite a bit by not having any indexes > at all when I do my mass copies. > > Thanks, and my apologies if that is a totally stupid > question. > > W > > __________________________________________________ > Do You Yahoo!? > Yahoo! Mail - Free email you can access from anywhere! > http://mail.yahoo.com/ -- Jie LIANG Internet Products Inc. 10350 Science Center Drive Suite 100, San Diego, CA 92121 Office:(858)320-4873 jliang@ipinc.com www.ipinc.com