From sivagami@worlddata.com Wed Oct 25 22:57:26 2000 Received: from hub.org.org (localhost [127.0.0.1]) by hub.org (8.10.1/8.11.0) with SMTP id e9PMvQ696400 for ; Wed, 25 Oct 2000 18:57:26 -0400 (EDT) (envelope-from pgsql-sql-owner@hub.org) Received: from hydra.worlddata.com (hydra.worlddata.com [209.244.192.166]) by hub.org (8.10.1/8.11.0) with ESMTP id e9PHrOO52009 for ; Wed, 25 Oct 2000 13:53:42 -0400 (EDT) (envelope-from sivagami@worlddata.com) Received: from dragon ([209.244.192.67]) by hydra.worlddata.com (Netscape Messaging Server 4.15) with SMTP id G2ZYX800.TLW for ; Wed, 25 Oct 2000 13:51:08 -0400 Message-ID: <006a01c03eac$231a0a20$43c0f4d1@worlddata.com> From: "Sivagami ." To: Subject: Add Constraint Date: Wed, 25 Oct 2000 13:51:00 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0067_01C03E8A.9BF927E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.3018.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 X-Archive-Number: 200010/226 X-Sequence-Number: 1892 This is a multi-part message in MIME format. ------=_NextPart_000_0067_01C03E8A.9BF927E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all, I am a newbie to Postgresql, but I am familiar with SQL. I am trying to add= a constraint to my table using the ALTER TABLE command. The command goes l= ike this : ALTER TABLE USER_SIGNUP ADD CONSTRAINT P_USER_SIGNUP_USER_ID PRIMARY KEY(user_id); But it is returning the error=20 ERROR: ALTER TABLE / ADD CONSTRAINT is not implemented=20 Can anyone guide me in the right direction??? Thanks. Shiva ------=_NextPart_000_0067_01C03E8A.9BF927E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
 
I am a newbie to Postgresql, but I am familiar with SQL= . I am=20 trying to add a constraint to my table using the ALTER TABLE command. The= =20 command goes like this :
 
ALTER TABLE USER_SIGNUP ADD=20 CONSTRAINT
P_USER_SIGNUP_USER_ID PRIMARY KEY(user_id);
 
But it is returning the error
ERROR:  ALTER TABLE / ADD CONSTRAINT is not implem= ented=20
 
Can anyone guide me in the right direction???
 
Thanks.
Shiva
------=_NextPart_000_0067_01C03E8A.9BF927E0-- From sszabo@megazone23.bigpanda.com Thu Oct 26 11:53:09 2000 Received: from thor.tht.net (thor.tht.net [209.47.145.4]) by hub.org (8.10.1/8.11.0) with ESMTP id e9QBr9U41552 for ; Thu, 26 Oct 2000 07:53:09 -0400 (EDT) (envelope-from sszabo@megazone23.bigpanda.com) Received: from megazone23.bigpanda.com (138.210.6.64.reflexcom.com [64.6.210.138]) by thor.tht.net (8.9.3/8.9.3) with ESMTP id BAA89144 for ; Thu, 26 Oct 2000 01:48:11 GMT (envelope-from sszabo@megazone23.bigpanda.com) Received: from localhost (sszabo@localhost) by megazone23.bigpanda.com (8.11.0/8.11.0) with ESMTP id e9Q5lhc24445; Wed, 25 Oct 2000 22:47:44 -0700 (PDT) Date: Wed, 25 Oct 2000 22:47:43 -0700 (PDT) From: Stephan Szabo To: "Sivagami ." cc: pgsql-sql@postgresql.org Subject: Re: Add Constraint In-Reply-To: <006a01c03eac$231a0a20$43c0f4d1@worlddata.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200010/238 X-Sequence-Number: 1905 On Wed, 25 Oct 2000, Sivagami . wrote: > Hi all, > > I am a newbie to Postgresql, but I am familiar with SQL. I am trying to add a constraint to my table using the ALTER TABLE command. The command goes like this : > > ALTER TABLE USER_SIGNUP ADD CONSTRAINT > P_USER_SIGNUP_USER_ID PRIMARY KEY(user_id); > > But it is returning the error > ERROR: ALTER TABLE / ADD CONSTRAINT is not implemented > > Can anyone guide me in the right direction??? We don't have full add constraint support yet. 7.0 allows you to add the subset of foreign keys supported and current sources should allow check constraints as well. To get the unique constraint portion, you can add a unique index on user_id (it's what the system would have done anyway). To get the non-null part is a little harder, you need to find the row in pg_attribute and set the attnotnull to true, and then make sure there aren't any null values already in the data set.