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

Re: BUG #5856: pg_attribute.attinhcount is not correct.

From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Naoya Anzai <anzai-naoya(at)mxu(dot)nes(dot)nec(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: BUG #5856: pg_attribute.attinhcount is not correct.
Date: 2011-03-31 12:35:43
Message-ID: 6CF92001890CDD19DB8DDEED@[] (view raw, whole thread or download thread mbox)
Lists: pgsql-bugspgsql-hackers

--On 31. März 2011 06:06:49 -0400 Noah Misch <noah(at)leadboat(dot)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 
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 



In response to

pgsql-hackers by date

Next:From: Bernd HelmleDate: 2011-03-31 12:38:00
Subject: wal_buffers = -1 and SIGHUP
Previous:From: Heikki LinnakangasDate: 2011-03-31 10:41:46
Subject: Re: SHMEM_INDEX_SIZE exceeded on startup

pgsql-bugs by date

Next:From: Martin HandsteinerDate: 2011-03-31 13:09:14
Subject: BUG #5961: JDBC Driver acceptURL does not check 'jdbc:postgresql:'
Previous:From: Jon NelsonDate: 2011-03-31 11:41:32
Subject: Re: backend for database 'A' crashes/is killed -> corrupt index in database 'B'

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