Re: partial "on-delete set null" constraint

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Rafal Pietrak <rafal(at)ztk-rp(dot)eu>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: partial "on-delete set null" constraint
Date: 2015-01-02 14:35:27
Message-ID: CANu8FixXcGPMtSopD7RoQw9AKDGWyj3L79bayu5fUCwTXDNjPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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""

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-01-02 15:03:03 Re: partial "on-delete set null" constraint
Previous Message Rafal Pietrak 2015-01-02 12:31:17 partial "on-delete set null" constraint