Re: ALTER TABLE ADD CONSTRAINT

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ALTER TABLE ADD CONSTRAINT
Date: 2001-05-11 17:58:35
Message-ID: 00a901c0da44$88415c30$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I am generating scripts from MSSQL Server and converting them to create
objects in PostgreSQL. It is suprisingly easy. However, I think I may have
hit a rock.
>
> It appears that PostgreSQL does not support listing constraints to be
added as in the following syntax:

I don't know why it won't accept that syntax, but I suspect that it might be
choking on the multiple additional constraints. Try adding each constraint
as a separate ALTER TABLE statement. This should work:

ALTER TABLE foo ADD FOREIGN KEY (fooid) REFERENCES bar (barid);
ALTER TABLE foo ADD FOREIGN KEY (footooid) REFERENCES baz (bazid);

> Is this true? Is this something that is being considered for addition?

If you can add multiple constraints via a single ALTER TABLE according to
the SQL standard, I suspect that it will be added someday. But since you can
add them individually, I would suspect the priority would be VERY low on the
list.

> Also, I see that alter table add constraint does not work for defaults.
Is this something that is going to be added?

That I do hope will be added since the only way to replicate the
functionality is to drop, readd and repopulate a table.

Greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message kapil c. tilwani 2001-05-11 18:14:19
Previous Message Ian Lance Taylor 2001-05-11 17:49:04 Re: PL/Perl without shared libperl.a