Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining ON DELETE CASCADE in pgAdmin 3

I can't find how to add ON DELETE CASCADE rule in pgAdmin 3. I want to achieve that if a record in the parent table is deleted, then the corresponding records in the child table will automatically be deleted.

Still, I can't find this option when creating tables visually in pgAdmin.

I can see something like this:

pgAdmin menu

But none of this seems to offers option to achieve what I want... Any ideas how to do it through pgAdmin?

like image 538
Whirlwind Avatar asked Sep 15 '25 23:09

Whirlwind


1 Answers

Oh, I just found it, it was simple, but still I will post it for future readers with a same question. When creating foreign key constraint there is Action tab and from there it is possible to define what you want to happen on update, or on delete:

enter image description here

like image 100
Whirlwind Avatar answered Sep 18 '25 18:09

Whirlwind