Re: Bug in MergeAttributesIntoExisting() function.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: amul sul <sul_amul(at)yahoo(dot)co(dot)in>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in MergeAttributesIntoExisting() function.
Date: 2016-01-04 14:47:59
Message-ID: CA+TgmoY8sqEZqVFYfgewFZQY6mGKGJUFuYfZXKWdxVO9BTVnBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 4, 2016 at 9:28 AM, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> wrote:
> On Mon, Jan 4, 2016 at 4:41 PM, amul sul <sul_amul(at)yahoo(dot)co(dot)in> wrote:
>> Hi,
>> In inheritance, child column's pg_attribute.attislocal flag not getting
>> updated, if it is inherited using ALTER TABLE <child> INHERIT <parent>.
>>
>> Due to this, if we try to drop column(s) from parent table, which are not
>> getting drop from child.
>> Attached herewith is quick patch fixing this issue.
> Seems like you missed following command in the demonstration test:
>
> ALTER TABLE c2 INHERIT p1;
>
>>
>> You can see columns are not dropped from child c2 table, which we have
>> inherited using ALTER command.
>
> I took a quick look at this and did some testing. Patch looks good to me.
> ALTER TABLE INHERIT missing the attislocal = false check.

This is not a bug. ALTER TABLE .. INHERIT isn't supposed to set
attislocal = false. attislocal tracks whether there was a local copy
of the attribute definition originally - here, the answer is yes, even
after the ALTER TABLE .. INHERIT.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-01-04 14:53:51 Re: Bug in MergeAttributesIntoExisting() function.
Previous Message Amit Langote 2016-01-04 14:43:03 Re: Bug in MergeAttributesIntoExisting() function.