Re: Drop foreign keys
От | Stephan Szabo |
---|---|
Тема | Re: Drop foreign keys |
Дата | |
Msg-id | 20030108080539.S76148-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | Drop foreign keys (Andreas Schlegel <schlegelaw@gmx.de>) |
Список | pgsql-general |
On 8 Jan 2003, Andreas Schlegel wrote: > Hi, > > I created some references with foreign keys. But now I have to drop > some of the references. What is the way to do this? Is there a command > for this? Or have I drop the table and recreate it? > Postgres gave the references names like "RI_ConstraintTrigger_494516". > If there is a way to drop them one by one how do I get the information > on which foreign key point these Postgres names? > > All references are created like this: > ... constraint tPerson_FK03 foreign key (titel) > references tTitel (tnr) > ON UPDATE CASCADE ON DELETE RESTRICT ... What version are you using? In 7.3, you should be able to say ALTER TABLE <table> DROP CONSTRAINT tPerson_FK03; In previous versions, you'll need to manually drop the three triggers that are created (you can find the correct triggers by looking for tgconstrname='tPerson_FK03') and you'll need to double quote the tgname for DROP TRIGGER commands.
В списке pgsql-general по дате отправления: