Re: DEFERRABLE NOT NULL constraint

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: DEFERRABLE NOT NULL constraint
Date: 2013-02-05 09:57:34
Message-ID: OrigoEmail.167.9af1b1f2672e0079.13ca9c371d2@prod2.officenet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<div>På tirsdag 05. februar 2013 kl. 10:39:43, skrev Darren Duncan &lt;<a href="mailto:darren(at)darrenduncan(dot)net" target="_blank">darren(at)darrenduncan(dot)net</a>&gt;:</div>

<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="display:inline; font-family: monospace; font-size: 12px;">Deferrable foreign key and unique key constraints I can understand, but ...<br>
<br>
On 2013.02.05 1:22 AM, Andreas Joseph Krogh wrote:<br>
&gt; +100 for having NOT NULL and CHECK-constraints deferrable:-)<br>
&gt; Is there any &quot;I want to sponsor development of &lt;feature-X&gt; with $xxx&quot; mechanism?<br>
<br>
I'd like to know what value there is in making NOT NULL and CHECK deferrable.<br>
<br>
While we're at it, do we want to make the column data type check constraints<br>
deferrable too, so you can initially assign any value at all without regard for<br>
the declared type of the column?  Then we only at constraints-immediate time<br>
say, sorry, you can't put a string in a number column, or, sorry, that number is<br>
too large, or that string is too long, or whatever.<br>
<br>
NOT NULL and CHECK constraints are effectively just part of a data type<br>
definition after all.  Postgres' current behavior is fairly consistent; if we<br>
make these deferrable, then why stop there?</div>
</blockquote>

<div> </div>

<div>The value of having NOT NULL deferrable is, well, to not check for NULL until the tx commits. When working with ORMs this often is the case, especially with circular FKs.</div>

<div> </div>

<div class="origo-email-signature">--<br>
Andreas Joseph Krogh &lt;andreak(at)officenet(dot)no&gt;      mob: +47 909 56 963<br>
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no<br>
Public key: http://home.officenet.no/~andreak/public_key.asc</div>

<div> </div>

Attachment Content-Type Size
unknown_filename text/html 1.8 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2013-02-05 10:04:27 Re: DEFERRABLE NOT NULL constraint
Previous Message Darren Duncan 2013-02-05 09:39:43 Re: DEFERRABLE NOT NULL constraint