Обсуждение: Deferrable NOT NULL constraints in 9.3?

Поиск
Список
Период
Сортировка

Deferrable NOT NULL constraints in 9.3?

От
andreak@officenet.no
Дата:
Hi hackers.
 
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.
 
Thanks.
 
--
Andreas Joseph Krogh <andreak@officenet.no>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc

Re: Deferrable NOT NULL constraints in 9.3?

От
Robert Haas
Дата:
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



Re: Deferrable NOT NULL constraints in 9.3?

От
Tom Lane
Дата:
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