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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Naoya Anzai <anzai-naoya(at)mxu(dot)nes(dot)nec(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5856: pg_attribute.attinhcount is not correct.
Date: 2011-02-03 16:24:42
Message-ID: AANLkTik6ArKPwnvA8_9XHo9j9+w4A2UEnsheX-mwR=Aj@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Jan 31, 2011 at 6:42 AM, Naoya Anzai
<anzai-naoya(at)mxu(dot)nes(dot)nec(dot)co(dot)jp> wrote:
> In PostgreSQL8.4.5, I found that the catalog pg_attribute.attinhcount is not
> correct.
>
> I executed the following queries.
>
> --------------------------------------------------------------------------
> create table "3_grandchild"();
> create table "2_child"();
> create table "1_parent"();
>
> alter table "3_grandchild" inherit "2_child";
> alter table "2_child" inherit "1_parent";
>
> alter table "3_grandchild" add column c1 text;
> alter table "2_child" add column c1 text;
> alter table "1_parent" add column c1 text;
>
> select c.relname,a.attname,a.attinhcount from pg_attribute a,pg_class c
> where a.attrelid=c.oid
> and relname in ('1_parent','2_child','3_grandchild')
> and attname not in('xmax','xmin','cmin','cmax','tableoid','ctid')
> order by relname;
>
>    relname    | attname | attinhcount
>  --------------+---------+-------------
>  1_parent     | c1      |           0
>  2_child      | c1      |           1
>  3_grandchild | c1      |           2
>  (3 rows)
> --------------------------------------------------------------------------
>
> "3_grandchild"'s attinhcount should be 1.

I think this is a manifestation the same problem mentioned here:

http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=31b6fc06d83c6de3644c8f2921eb7de0eb92fac3

I believe this requires some refactoring to fix. It would be good to do that.

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2011-02-04 02:11:56 Re: BUG #5862: Postgres dumps core upon a connection attempt
Previous Message Matt Zinicola 2011-02-03 12:50:49 Re: BUG #5862: Postgres dumps core upon a connection attempt

Browse pgsql-hackers by date

  From Date Subject
Next Message Ross J. Reedstrom 2011-02-03 16:25:50 Re: ALTER EXTENSION UPGRADE, v3
Previous Message Tim Bunce 2011-02-03 16:09:51 Re: Optimize PL/Perl function argument passing [PATCH]