Re: [HACKERS] pg_attribute.attisinherited ?

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] pg_attribute.attisinherited ?
Date: 2002-08-26 09:28:21
Message-ID: 20020826052821.74f4b1a2.alvherre@atentus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

En Sun, 25 Aug 2002 17:34:21 +0800 (WST)
Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> escribió:

Hi again,

> Yeah it is an issue that needs to be fixed.

I'm thinking about the ONLY part in the grammar in ALTER TABLE... DROP
COLUMN and RENAME COLUMN. I think they should not be there: they only
create noise and chances of ill behavior. If I modify only the parent
table, then I'm able to create a column on the child table with
different datatype and same name as new column on parent, causing
subsequent backend crash.

Consider

CREATE TABLE foo (a int);
CREATE TABLE bar () INHERITS (foo);
ALTER TABLE ONLY foo RENAME a TO b;
ALTER TABLE bar ADD COLUMN b TEXT;

regression=# INSERT INTO bar values (1, 'hello world');
INSERT 205625 1
regression=# SELECT * FROM foo;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!#

What does people think about removing the support for ONLY in these
directives?

But this is a different problem and requires a different patch.

Here I post a new version of attisinherited; this one includes the tests
in AlterTableDropColumn and renameatt so inherited columns can not be
dropped nor renamed. Please review this new version. Regression tests
are also included, as is the modification of catalog.sgml.

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"El Maquinismo fue proscrito so pena de cosquilleo hasta la muerte"
(Ijon Tichy en Viajes, Stanislaw Lem)

Attachment Content-Type Size
attisinheritedWithTest.patch application/octet-stream 60.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2002-08-26 10:15:53 Re: PostgreSQL 7.2.2 and docs
Previous Message Karel Zak 2002-08-26 08:39:10 Re: Database Caching

Browse pgsql-patches by date

  From Date Subject
Next Message Nigel J. Andrews 2002-08-26 10:36:10 Re: [HACKERS] TODO Done. Superuser backend slot reservations
Previous Message Gerhard Hintermayer 2002-08-26 07:00:16 Re: libpgtcl modifications