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
pgsql-sql by date
|Next:||From: Brian C. Doyle||Date: 2000-10-26 10:08:39|
|Subject: Re: Alternate Database Locations |
|Previous:||From: Jie Liang||Date: 2000-10-26 05:27:31|
|Subject: Re: How to call a shell command in rule|