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@[172.26.14.62]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-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
(see
<http://git.postgresql.org/gitweb?p=users/bernd/postgres.git;a=shortlog;h=refs/heads/notnull_constraint>
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

In response to

Browse pgsql-bugs by date

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

Browse pgsql-hackers by date

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