Skip site navigation (1) Skip section navigation (2)

Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bernd Helmle <mailings(at)oopsware(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Geery <andrew(dot)geery(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch
Date: 2011-06-29 17:07:25
Message-ID: BANLkTimq5p1=1zzrgubXk4LNV3h6xc3URw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Wed, Jun 29, 2011 at 12:51 PM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com> wrote:
> Excerpts from Robert Haas's message of lun jun 27 10:35:59 -0400 2011:
>> On Mon, Jun 27, 2011 at 3:08 AM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>
>> > I would summarise the consistency requirements as:
>> >
>> > 1). ADD CONSTRAINT should leave both parent and child tables in the
>> > same state as they would have been if the constraint had been defined
>> > at table creation time.
>> >
>> > 2). DROP CONSTRAINT should leave both parent and child tables in the
>> > same state as if the constraint had never existed (completely
>> > reversing the effects of ADD CONSTRAINT).
>> >
>> > I don't have a strong opinion as to whether or not the NOT NULL part
>> > of a PK should be inherited, provided that it is consistent with the
>> > above.
>> >
>> > I guess that if I were forced to choose, I would say that the NOT NULL
>> > part of a PK should not be inherited, since I do think of it as part
>> > of the PK, and PKs are not inherited.
>>
>> OK, I see your point, and I agree with you.
>
> Interesting.  This whole thing requires quite a bit of rejiggering in
> the initial transformation phase, I think, but yeah, I see the points
> here and I will see to them.  Does this mean that "NOT NULL PRIMARY KEY"
> now behaves differently?  I think it does , because if you drop the PK
> then the field needs to continue being not null.

Yeah, I think an implicit not-null because you made it a primary key
is now different from one that you write out.

> And here I was thinking that this was just a quick job to enable NOT
> VALID constraints ...

Bwahaha.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-hackers by date

Next:From: Florian PflugDate: 2011-06-29 17:11:52
Subject: Re: Range Types, constructors, and the type system
Previous:From: David E. WheelerDate: 2011-06-29 17:05:31
Subject: Re: Range Types, constructors, and the type system

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group