Thread

  1. Deferrable NOT NULL constraints in 9.3?

    Andreas Joseph Krogh <andreak@officenet.no> — 2012-11-08T09:45:28Z

    <div>Hi hackers.</div>
    
    <div> </div>
    
    <div>Are there any plans to include DEFERRABLE NOT NULL constraints in 9.3 so one can do this?</div>
    
    <div>
    <pre class="lang-sql prettyprint prettyprinted" style="">
    create table test(a varchar not null deferrable initially deferred);</pre>
    </div>
    
    <div>This works in Oracle and is quite handy when working with ORMs.</div>
    
    <div> </div>
    
    <div>Thanks.</div>
    
    <div> </div>
    
    <div class="origo-email-signature">--<br>
    Andreas Joseph Krogh &lt;andreak@officenet.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>
    
  2. Re: Deferrable NOT NULL constraints in 9.3?

    Robert Haas <robertmhaas@gmail.com> — 2012-11-08T17:14:53Z

    On Thu, Nov 8, 2012 at 4:45 AM,  <andreak@officenet.no> wrote:
    > Are there any plans to include DEFERRABLE NOT NULL constraints in 9.3 so one
    > can do this?
    >
    > create table test(a varchar not null deferrable initially deferred);
    >
    > This works in Oracle and is quite handy when working with ORMs.
    
    Not to my knowledge ... although I can't claim to know everything that
    anyone is working on.
    
    -- 
    Robert Haas
    EnterpriseDB: http://www.enterprisedb.com
    The Enterprise PostgreSQL Company
    
    
    
  3. Re: Deferrable NOT NULL constraints in 9.3?

    Tom Lane <tgl@sss.pgh.pa.us> — 2012-11-08T18:51:50Z

    Robert Haas <robertmhaas@gmail.com> writes:
    > On Thu, Nov 8, 2012 at 4:45 AM,  <andreak@officenet.no> wrote:
    >> Are there any plans to include DEFERRABLE NOT NULL constraints in 9.3 so one
    >> can do this?
    >> 
    >> create table test(a varchar not null deferrable initially deferred);
    >> 
    >> This works in Oracle and is quite handy when working with ORMs.
    
    > Not to my knowledge ... although I can't claim to know everything that
    > anyone is working on.
    
    You could get the effect by applying the not-null check in a custom
    constraint trigger.  A bit tedious but it'd work.
    
    			regards, tom lane