Re: Add Constraint - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Add Constraint
Date
Msg-id Pine.BSF.4.10.10010252245190.24391-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Add Constraint  ("Sivagami ." <sivagami@worlddata.com>)
List pgsql-sql
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
TABLEcommand. 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.




pgsql-sql by date:

Previous
From: Jie Liang
Date:
Subject: Re: How to call a shell command in rule
Next
From: Tomas Berndtsson
Date:
Subject: Re: Query Problem