Re: ALTER TABLE ADD CONSTRAINT
От | Gregory Wood |
---|---|
Тема | Re: ALTER TABLE ADD CONSTRAINT |
Дата | |
Msg-id | 00a901c0da44$88415c30$7889ffcc@comstock.com обсуждение исходный текст |
Ответ на | ALTER TABLE ADD CONSTRAINT ("Ian Harding" <ianh@co.pierce.wa.us>) |
Список | 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
В списке pgsql-general по дате отправления: