Re: Add Constraint

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "Sivagami (dot)" <sivagami(at)worlddata(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Add Constraint
Date: 2000-10-26 05:47:43
Message-ID: Pine.BSF.4.10.10010252245190.24391-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Brian C. Doyle 2000-10-26 10:08:39 Re: Alternate Database Locations
Previous Message Jie Liang 2000-10-26 05:27:31 Re: How to call a shell command in rule