pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedAdd Constraint
2+ messages / 2 participants
[nested] [flat]
* Add Constraint
@ 2000-10-25 17:51 Sivagami . <sivagami@worlddata.com>
0 siblings, 1 reply; 2+ messages in thread
From: Sivagami . @ 2000-10-25 17:51 UTC (permalink / raw)
To: pgsql-sql
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???
Thanks.
Shiva
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Add Constraint
@ 2000-10-26 05:47 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: Sivagami . <sivagami@worlddata.com>
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Szabo @ 2000-10-26 05:47 UTC (permalink / raw)
To: Sivagami . <sivagami@worlddata.com>; +Cc: 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-10-26 05:47 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-10-25 17:51 Add Constraint Sivagami . <sivagami@worlddata.com>
2000-10-26 05:47 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox