Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: KaiGai Kohei <kaigai@kaigai.gr.jp>
Cc: Robert Haas <robertmhaas@gmail.com>, KaiGai Kohei <kaigai@ak.jp.nec.com>, pgsql-hackers@postgresql.org, Thom Brown <thombrown@gmail.com>, Alvaro Herrera <alvherre@commandprompt.com>
Date: 2010-01-02T19:32:36Z
Lists: pgsql-hackers
KaiGai Kohei <kaigai@kaigai.gr.jp> writes:
> (2009/12/30 10:38), Robert Haas wrote:
>> No longer applies. Can you rebase?
> The attached patch is the rebased revision.
I'm not really impressed with this patch, because it will reject
perfectly legitimate multiple-inheritance cases (ie, cases where there's
more than one inheritance path from the same parent). This works fine
at the moment:
regression=# create table p1(f1 int, f2 int);
CREATE TABLE
regression=# create table c1(f3 int) inherits (p1);
CREATE TABLE
regression=# create table c2(f4 int) inherits (p1);
CREATE TABLE
regression=# create table cc(f5 int) inherits (c1,c2);
NOTICE: merging multiple inherited definitions of column "f1"
NOTICE: merging multiple inherited definitions of column "f2"
CREATE TABLE
regression=# \d cc
Table "public.cc"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |
f2 | integer |
f3 | integer |
f4 | integer |
f5 | integer |
Inherits: c1,
c2
regression=# alter table p1 rename f2 to ff2;
ALTER TABLE
regression=# \d cc
Table "public.cc"
Column | Type | Modifiers
--------+---------+-----------
f1 | integer |
ff2 | integer |
f3 | integer |
f4 | integer |
f5 | integer |
Inherits: c1,
c2
I don't think that protecting against cases where things won't work
is an adequate reason for breaking cases that do work.
regards, tom lane