0

enter image description here

If "predmet" is a FK to "predmeti", and "nositelj" is a FK to "nastavnici",

what will happen if I specify ON DELETE CASCADE to both foreign keys and delete one of the entities? Would it produce an error?

Edit: I'm using the latest version of PostgreSQL.

burnall
  • 832
  • 5
  • 10
Tool
  • 12,126
  • 15
  • 70
  • 120
  • This is a bad design, it is not in a so-called normal form. – Al Kepp Dec 16 '12 at 20:36
  • If you use and refer to an image, it might help if it were readable – vol7ron Dec 16 '12 at 22:00
  • 1
    `What will happen if I specify ON DELETE CASCADE to both foreign keys and delete one of the entities?` I don't know... what *will* happen? `Would it produce an error?` I don't know... does it? What have you tried? – vol7ron Dec 16 '12 at 22:03
  • Closely related: http://stackoverflow.com/questions/8394177/complex-foreign-key-constraint-in-sqlalchemy – Erwin Brandstetter Dec 17 '12 at 02:01

1 Answers1

1

Read manual for your RDBMS (you have not specified it). Typically circular cascade forbidden - you will get an error on create.

UPDATED: try http://sqlfiddle.com/#!1/24df4/2/0 It seems it is not forbidden - remove recursively.

Someone very kind minused me, because i have fixed the tags and it makes my post incorrect)

burnall
  • 832
  • 5
  • 10