Re: Bug in MergeAttributesIntoExisting() function.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug in MergeAttributesIntoExisting() function.
Дата
Msg-id 11257.1451919231@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug in MergeAttributesIntoExisting() function.  (amul sul <sul_amul@yahoo.co.in>)
Ответы Re: Bug in MergeAttributesIntoExisting() function.  (amul sul <sul_amul@yahoo.co.in>)
Список pgsql-hackers
amul sul <sul_amul@yahoo.co.in> writes:
> In inheritance, child column's pg_attribute.attislocal flag not getting updated, if it is inherited using ALTER TABLE
<child>INHERIT <parent>.
 

I think this patch is wrong and you have broken the intended behavior.
It's a bit hard to tell though because your example is confused.

> CREATE TABLE p1 (a int , b int, c int, d int);

> CREATE TABLE c1 () inherits (p1);CREATE TABLE c2 (a int , b int, c int, d int);

> --Drop parent's column
> ALTER TABLE p1 DROP COLUMN b;
> ALTER TABLE p1 DROP COLUMN c;
> ALTER TABLE p1 DROP COLUMN d;

> postgres=# \d p1
>       Table "public.p1"
>  Column |  Type   | Modifiers 
> --------+---------+-----------
>  a      | integer | 
> Number of child tables: 2 (Use \d+ to list them.)

Say what?  At this point only c1 is a child of p1.  I assume you've
left something out, either an ALTER INHERIT or an INHERITS clause
in CREATE TABLE c2.

Either way, however, the way you declared c2, it has an independent
local definition of all four columns, and so they should not go away
even if the parent's columns go away.  This is exactly the purpose
that attislocal was created to serve, and your patch destroys it.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Bug in MergeAttributesIntoExisting() function.
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [PATCH] Refactoring of LWLock tranches