Re: 7.4 - TODO : alter table drop foreign key
От | Stephan Szabo |
---|---|
Тема | Re: 7.4 - TODO : alter table drop foreign key |
Дата | |
Msg-id | 20021205084241.M2049-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Re: 7.4 - TODO : alter table drop foreign key ("Dan Langille" <dan@langille.org>) |
Ответы |
Re: 7.4 - TODO : alter table drop foreign key
|
Список | pgsql-hackers |
On Thu, 5 Dec 2002, Dan Langille wrote: > On 5 Dec 2002 at 8:20, Stephan Szabo wrote: > > > > > On Thu, 5 Dec 2002, Dan Langille wrote: > > > > > We support "alter table add foreign key". How about supporting > > > "alter table drop foreign key"? > > > > > > - he said as he went to drop a foreign key > > > > It seems to work for me on my 7.3b2 system with > > alter table <table> drop constraint <constraint name>; > > Premature send.. sorry > > How was that FK added? How did you determine the constraint name? alter table <table> add constraint <name> foreign key ... > How would you do that if the FK was added with the following syntax? > > alter table <table> > add foreign key (<column>) > references <othertable> (<othercolumn>) > on update cascade on delete cascade; IIRC, the constraint will get an automatic name of the form $<n> in such cases. I believe if you do a \d on the table, it gives the name in the constraint definitions (on one of mine i get: Foreign Key constraints: $1 FOREIGN KEY (a) REFERENCES qqq(a) ON UPDATE CASCADE ON DELETE NO ACTION Where $1 is the name of the constraint.
В списке pgsql-hackers по дате отправления: