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 14:24:36
Message-ID: OrigoEmail.18f.46b7c3475c4bcbb.13caaba25b5@prod2.officenet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<div>På tirsdag 05. februar 2013 kl. 14:13:20, skrev Chris Angelico &lt;<a href="mailto:rosuav(at)gmail(dot)com" target="_blank">rosuav(at)gmail(dot)com</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;">On Tue, Feb 5, 2013 at 11:32 PM, Alban Hertroys &lt;haramrae(at)gmail(dot)com&gt; wrote:<br>
&gt; On 5 February 2013 12:41, Andreas Joseph Krogh &lt;andreak(at)officenet(dot)no&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; There are lots of things you can do, but when it's the ORM which does it<br>
&gt;&gt; you have limited control, and that's the way it should to be (me as<br>
&gt;&gt; application-developer having to worry less about such details).<br>
&gt;<br>
&gt; In that case it's your ORM that needs fixing, not the database.<br>
<br>
Agreed. One of the differences between MySQL and PostgreSQL is that<br>
the latter gives you a database with rules, while the former is a<br>
place for an application to store data. This last couple of weeks I've<br>
been working with a really sloppily-built application (and a very<br>
popular one too, so I won't name names), and it fits MySQL<br>
perfectly... What I'd much rather do is build real rules that may not<br>
EVER be violated. While I can see the value in deferring foreign key<br>
constraints (circular references - never used 'em though), I don't see<br>
any reason to create a record with a NULL and then replace that NULL<br>
before committing. Sort out program logic first; then look to the<br>
database.<br>
<br>
Making people's lives easier in the short term is NOT the greatest<br>
goal of a database. Consistent data will make the admins' lives far<br>
easier in the long term. I do not ever want to have to deal with<br>
BTrieve file corruption in my life.</div>
</blockquote>

<div> </div>

<div>I've been using PG since v-6.5 and I'm very aware of its strengths, and also its weaknesses. There really isn't an argument for not having NOT NULL deferrable constraints, other than -hackers not prioritizing it, which I understand perfectly well as they have lots of other interesting stuff on their plate.</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>
</div>

Attachment Content-Type Size
unknown_filename text/html 2.4 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2013-02-05 14:25:51 Re: DEFERRABLE NOT NULL constraint
Previous Message Vick Khera 2013-02-05 14:11:18 Re: COPY table to file missing quotation marks