Re: Constraints/On Delete...

Поиск
Список
Период
Сортировка
От Boget, Chris
Тема Re: Constraints/On Delete...
Дата
Msg-id 4040BBE81A9AD411BD27009027887A7C0431CC@tiger.wild.net
обсуждение исходный текст
Ответ на Constraints/On Delete...  ("Boget, Chris" <chris@wild.net>)
Ответы Re: Constraints/On Delete...  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general

> ALTER TABLE "second" DROP CONSTRAINT "$1";

So the reason mine wasn't working (which looks exactly
like yours) is because there was the above constraint on
the table?  What is the $1?  How can I view the existing
constraints for any particular table?

> ALTER TABLE "second" ADD CONSTRAINT "secondfk"
> FOREIGN KEY (name) REFERENCES "first"("record_num")
> ON DELETE CASCADE;

This worked like a charm!  Thank you very much for your help!

> No. Referential actions are applied on changes to the primary
> key side of the constraint (in this case "first"), so deletes
> from first cause actions on second.

Ok, I just wanted to make sure.  It just looked like it was the
other way around.  Because it appeared that the pointer (the
"references") was going from "second" to "first".  I guess that
when records are deleted from the "first", it asks what tables are
referencing one of it's columns and it's not that it implicitely
already knows..?

Again, thank you for all your help!

Chris

В списке pgsql-general по дате отправления:

Предыдущее
От: "Boget, Chris"
Дата:
Сообщение: Re: Constraints/On Delete...
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Constraints/On Delete...