I've come upon a misbehaviour of drop column, where drop column
unconditionally drops inherited column from child tables.

What it should do is to check if the same column is not inherited from
other parents and drop it only when it is not

Here is the test case:


hannu=# create table p1(id int, name text);
CREATE TABLE
hannu=# create table p2(id2 int, name text);
CREATE TABLE
hannu=# create table c1(age int) inherits(p1,p2);
NOTICE:  CREATE TABLE: merging multiple inherited definitions of
attribute "name"
CREATE TABLE
hannu=# \d c1                          
      Table "public.c1"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 name   | text    | 
 id2    | integer | 
 age    | integer | 

hannu=# alter table p1 drop column name;
ALTER TABLE
hannu=# \d c1
      Table "public.c1"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 id2    | integer | 
 age    | integer | 


The column "c1.name" should survive the drop from p1, as it is also
inherited from p2. 

--------------------
Hannu


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to