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

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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(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 22:42:19
Message-ID: 1309386811-sup-35@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
Excerpts from Robert Haas's message of mié jun 29 18:16:20 -0400 2011:
> On Wed, Jun 29, 2011 at 4:59 PM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com> wrote:
> > Excerpts from Robert Haas's message of mié jun 29 13:07:25 -0400 2011:
> >> 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:
> >
> >> > 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.
> >
> > Actually, it wasn't that hard, but I'm not really sure I like the
> > resulting code:
> 
> What don't you like about it?

Scribbling on attnotnull like that seems ... kludgy (we have to walk the
attr list three times: first to copy, second to reset all the attnotnull
flags, third to set those of interest).  The fact that we need a copy to
scribble on, seems wrong as well (we weren't creating a copy before).
The existing mechanisms to copy tupledescs aren't very flexible, but
improving that seems overengineering to me.

> My concern is that I'm not sure it's correct...

Ah, well, I don't see any reason not to trust it currently.  I am afraid
it could easily break in the future though.

-- 
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

pgsql-hackers by date

Next:From: Tatsuo IshiiDate: 2011-06-29 23:01:36
Subject: Adding Japanese README
Previous:From: Robert HaasDate: 2011-06-29 22:16:20
Subject: Re: Re: starting to review the Extend NOT NULL representation to pg_constraint patch

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