pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feeddelete with referential integrity
3+ messages / 3 participants
[nested] [flat]
* delete with referential integrity
@ 2002-08-29 16:54 Michael Zouroudis <mzouroudis@idealcorp.com>
2002-08-29 17:07 ` Re: delete with referential integrity Ragnar Kjørstad <postgres@ragnark.vestdata.no>
2002-08-29 17:37 ` Re: delete with referential integrity Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: Michael Zouroudis @ 2002-08-29 16:54 UTC (permalink / raw)
To: pgsql-admin
i promise this will be my last post for a long time. my last problem on
my db is caused by a trigger. i have three tables involved; assets,
book_asset, and book. because of integrity constraints, i have to
delete the record from book_asset, then book, and finally assets. all
inserts, updates, and deletes are done through the assets table, and i
have a trigger on assets that first deletes book_asset, then books, and
finally assets. the problem is when it deletes assets on that third
delete, it sends the db into a recursive loop(the delete on assets
starts the trigger again). i am searching for an answer, but have not
found one in the last hour and a half. if someone has encounted this
problem before and knows a solution, i would be very grateful. the only
thing i have found is a function called _funny_dup17()_, but this seems
to be only for regression tests. besides from that, i am out of ideas.
thanks,
Mike Zouroudis
Intern
__________________________________________________
I.D.E.A.L. Technology Corporation - Orlando Office
http://www.idealcorp.com - 407.999.9870 x14
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: delete with referential integrity
2002-08-29 16:54 delete with referential integrity Michael Zouroudis <mzouroudis@idealcorp.com>
@ 2002-08-29 17:07 ` Ragnar Kjørstad <postgres@ragnark.vestdata.no>
1 sibling, 0 replies; 3+ messages in thread
From: Ragnar Kjørstad @ 2002-08-29 17:07 UTC (permalink / raw)
To: Michael Zouroudis <mzouroudis@idealcorp.com>; +Cc: pgsql-admin
On Thu, Aug 29, 2002 at 12:54:23PM -0400, Michael Zouroudis wrote:
> i promise this will be my last post for a long time. my last problem on
> my db is caused by a trigger. i have three tables involved; assets,
> book_asset, and book. because of integrity constraints, i have to
> delete the record from book_asset, then book, and finally assets. all
> inserts, updates, and deletes are done through the assets table, and i
> have a trigger on assets that first deletes book_asset, then books, and
> finally assets. the problem is when it deletes assets on that third
> delete, it sends the db into a recursive loop(the delete on assets
> starts the trigger again). i am searching for an answer, but have not
> found one in the last hour and a half. if someone has encounted this
> problem before and knows a solution, i would be very grateful. the only
> thing i have found is a function called _funny_dup17()_, but this seems
> to be only for regression tests. besides from that, i am out of ideas.
You should be able to set you constraint to delete the entries in the
other tables automaticly instead of refusing. Then you don't need the
triggers.
--
Ragnar Kjørstad
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: delete with referential integrity
2002-08-29 16:54 delete with referential integrity Michael Zouroudis <mzouroudis@idealcorp.com>
@ 2002-08-29 17:37 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2002-08-29 17:37 UTC (permalink / raw)
To: Michael Zouroudis <mzouroudis@idealcorp.com>; +Cc: pgsql-admin
Michael Zouroudis <mzouroudis@idealcorp.com> writes:
> because of integrity constraints, i have to
> delete the record from book_asset, then book, and finally assets. all
> inserts, updates, and deletes are done through the assets table, and i
> have a trigger on assets that first deletes book_asset, then books, and
> finally assets. the problem is when it deletes assets on that third
> delete, it sends the db into a recursive loop(the delete on assets
> starts the trigger again).
Why don't you simply let the system carry on with the deletion that the
trigger was called for?
Seems to me the answer to the problem "my trigger is infinitely
recursive" is "make your trigger not recurse".
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-08-29 17:37 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-08-29 16:54 delete with referential integrity Michael Zouroudis <mzouroudis@idealcorp.com>
2002-08-29 17:07 ` Ragnar Kjørstad <postgres@ragnark.vestdata.no>
2002-08-29 17:37 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox