Skip site navigation (1) Skip section navigation (2)

Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>, pgsql-hackers(at)postgresql(dot)org, Thom Brown <thombrown(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [BUG?] strange behavior in ALTER TABLE ... RENAME TO on inherited columns
Date: 2010-01-02 19:32:36
Message-ID: 9954.1262460756@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-01-02 19:41:16
Subject: Re: Add subdirectory support for DATA/DOCS with PGXS
Previous:From: Pavel StehuleDate: 2010-01-02 18:59:28
Subject: Re: quoting psql varible as identifier

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group