pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bernd Helmle <mailings@oopsware.de>
To: Noah Misch <noah@leadboat.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Naoya Anzai <anzai-naoya@mxu.nes.nec.co.jp>
Cc: pgsql-hackers@postgresql.org
Subject: Re: BUG #5856: pg_attribute.attinhcount is not correct.
Date: Thu, 31 Mar 2011 14:35:43 +0200
Message-ID: <6CF92001890CDD19DB8DDEED@[172.26.14.62]> (raw)
In-Reply-To: <20110331100649.GA7286@tornado.gateway.2wire.net>
References: <201101311142.p0VBgVGd019556@wwwmaster.postgresql.org>
	<AANLkTik6ArKPwnvA8_9XHo9j9+w4A2UEnsheX-mwR=Aj@mail.gmail.com>
	<20110331100649.GA7286@tornado.gateway.2wire.net>



--On 31. März 2011 06:06:49 -0400 Noah Misch <noah@leadboat.com> wrote:

> The best way I can see is to make ATExecAddColumn more like ATExecDropColumn,
> ATAddCheckConstraint, and ATExecDropConstraint.  Namely, recurse at Exec-time
> rather than Prep-time, and cease recursing when we satisfy the ADD COLUMN
> with a merge.  Did you have something else in mind?
>
> Incidentally, when we satisfy an ADD COLUMN with a merge, we do not check or
> update attnotnull:
>
> create table parent();
> create table child(c1 text) inherits (parent);
> alter table parent add column c1 text not null;
> \d child
>
> We could either update attnotnull (and schedule a phase-3 scan of the table)
> or throw an error.  For ALTER TABLE ... INHERIT, we throw the error.  For
> CREATE TABLE ... INHERITS, we add the NOT NULL (and no scan is needed).  I'd
> weakly lean toward throwing the error.  Opinions?

Hmm this looks like the same kind of problem i'm currently faced with when 
working on tracking inheritance counters for NOT NULL constraint at the moment 
(see 
<http://git.postgresql.org/gitweb?p=users/bernd/postgres.git;a=shortlog;h=refs/heads/notnull_constrai...; 
for a heavy WIP patch). It currently recurses and seems to do the right thing 
(tm) for your example above, but i'm far from being certain that the way i'm 
undertaking here is correct. It indeed discovered a bug i had in my recursion 
code...

-- 
Thanks

	Bernd



view thread (13+ messages)  latest in thread

Message-ID: <6CF92001890CDD19DB8DDEED@[172.26.14.62]>
Permalink:  ../6CF92001890CDD19DB8DDEED@%5B172.26.14.62%5D/
Also on:    postgresql.org/message-id/6CF92001890CDD19DB8DDEED@[172.26.14.62]

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: mailings@oopsware.de, noah@leadboat.com, robertmhaas@gmail.com, anzai-naoya@mxu.nes.nec.co.jp, pgsql-hackers@postgresql.org
  Subject: Re: BUG #5856: pg_attribute.attinhcount is not correct.
  In-Reply-To: <6CF92001890CDD19DB8DDEED@[172.26.14.62]>
  References: <201101311142.p0VBgVGd019556@wwwmaster.postgresql.org> <AANLkTik6ArKPwnvA8_9XHo9j9+w4A2UEnsheX-mwR=Aj@mail.gmail.com> <20110331100649.GA7286@tornado.gateway.2wire.net> <6CF92001890CDD19DB8DDEED@[172.26.14.62]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox