Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002
    Posts
    98

    Unanswered: cascading delete

    does any one have instances where "on delete cascade" is written in, but when trying to delete the record in parent table, it still gives errors stating the key is still being referenced?

  2. #2
    Join Date
    Aug 2002
    Location
    Belgium
    Posts
    534
    Did you try to implement it with triggers?
    rws

  3. #3
    Join Date
    Nov 2002
    Posts
    98
    Originally posted by Roelwe
    Did you try to implement it with triggers?
    that's precisely the problem...
    in my understanding the "on delete cascade" should serve the function of a delete trigger.

    i am sure it would work if i write a delete trigger, but i want to know why would the "on delete cascade" not work..

  4. #4
    Join Date
    Nov 2002
    Posts
    98
    example:

    create table test
    (testid serial primary key)

    create table test2
    (testid integer,
    foreign key (testid)
    references test
    on delete cascade)

    if i delete a record in test(which is referenced in test2)
    the error message would state that the key is still being referenced and could not be deleted

    but isn't it what "on delete cascade" is supposed to handle??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •