The parent table is called "login" and the child
one is "faculty".
The error says:
ERROR: null value in column "idlogin" violates not
null-constraint
CONTEXT: SQL statement "UPDATE ONLY
"public"."faculty" SET "idlogin"=NULL WHERE "idlogin" = "$1"
To be honest, I created a new test DB and added a
parent and a child table with ON DELETE CASCADE and when I deleted the parent
record it was all OK. I'm wondering if the problem could be that the "login" and
"faculty" tables were not initially created with ON DELETE CASCADE on their
relationship, but instead, I modified it later using a query. Any case, here I
post both tables' structure.
Create table "login"
( "idlogin" Serial NOT NULL, "user" Varchar(15) NOT NULL UNIQUE, "passqword" Varchar(15) NOT NULL, primary key ("idlogin") ) Without Oids; Create table "faculty"
( "idfaculty" Serial NOT NULL, "idlogin" Integer NOT NULL, "name" Varchar(30) NOT NULL UNIQUE, "vicename" Varchar(25) NOT NULL, "lastname" Varchar(35) NOT NULL, primary key ("idfacultad") ) Without Oids;
|