Re: Bug in MergeAttributesIntoExisting() function. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Bug in MergeAttributesIntoExisting() function.
Date
Msg-id CA+TgmoY8sqEZqVFYfgewFZQY6mGKGJUFuYfZXKWdxVO9BTVnBA@mail.gmail.com
Whole thread Raw
In response to Re: Bug in MergeAttributesIntoExisting() function.  (Rushabh Lathia <rushabh.lathia@gmail.com>)
List pgsql-hackers
On Mon, Jan 4, 2016 at 9:28 AM, Rushabh Lathia <rushabh.lathia@gmail.com> wrote:
> On Mon, Jan 4, 2016 at 4:41 PM, amul sul <sul_amul@yahoo.co.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



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Bug in MergeAttributesIntoExisting() function.
Next
From: Tom Lane
Date:
Subject: Re: Bug in MergeAttributesIntoExisting() function.