Re: partial "on-delete set null" constraint - Mailing list pgsql-general

From Melvin Davidson
Subject Re: partial "on-delete set null" constraint
Date
Msg-id CANu8FixXcGPMtSopD7RoQw9AKDGWyj3L79bayu5fUCwTXDNjPg@mail.gmail.com
Whole thread Raw
In response to partial "on-delete set null" constraint  (Rafal Pietrak <rafal@ztk-rp.eu>)
List pgsql-general
Your main problem is that column "domain" of mailboxes is specified as NOT NULL, so of course the "SET NULL" option will not work.

Here is the full message I see when I execute your code, which should
be self explanatory.

ERROR:  null value in column "domain" violates not-null constraint
DETAIL:  Failing row contains (null, null, Hello).
CONTEXT:  SQL statement "UPDATE ONLY "public"."mailboxes" SET "username" = NULL, "domain" = NULL WHERE $1 OPERATOR(pg_catalog.=) "username" AND $2 OPERATOR(pg_catalog.=) "domain""
********** Error **********

ERROR: null value in column "domain" violates not-null constraint
SQL state: 23502
Detail: Failing row contains (null, null, Hello).
Context: SQL statement "UPDATE ONLY "public"."mailboxes" SET "username" = NULL, "domain" = NULL WHERE $1 OPERATOR(pg_catalog.=) "username" AND $2 OPERATOR(pg_catalog.=) "domain""

pgsql-general by date:

Previous
From: Rafal Pietrak
Date:
Subject: partial "on-delete set null" constraint
Next
From: Adrian Klaver
Date:
Subject: Re: partial "on-delete set null" constraint