pg_attribute.attisinherited ?

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_attribute.attisinherited ?
Date: 2002-08-23 22:14:28
Message-ID: Pine.LNX.4.44.0208231806140.12046-100000@cm-lcon1-46-187.cm.vtr.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

This should not happen, I guess:

alvh=> CREATE TABLE test_inh (a int);
CREATE TABLE
alvh=> CREATE TABLE test_inh_child (b int) INHERITS (test_inh);
CREATE TABLE
alvh=> ALTER TABLE test_inh_child RENAME a TO c;
ALTER TABLE
alvh=> SELECT * FROM test_inh;
ERROR: Relation "test_inh_child" has no column "a"

alvh=> ALTER TABLE test_inh_child RENAME c TO a;
ALTER TABLE
alvh=> ALTER TABLE test_inh_child DROP COLUMN a;
ALTER TABLE
alvh=> SELECT * FROM test_inh;
ERROR: Relation "test_inh_child" has no column "a"

I remember Tom suggested adding something like attisinherited and
preventing this kind of operations on such attributes, because one can
do things such as

alvh=> ALTER TABLE test_inh_child ADD COLUMN a TEXT;
ALTER TABLE
alvh=> INSERT INTO test_inh_child VALUES (1, 'hello world');
INSERT 33449 1
alvh=> SELECT * FROM test_inh;
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.
!>

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Entristecido, Wutra
echa a Freyr a rodar
y a nosotros al mar" (cancion de Las Barreras, Heliconia)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2002-08-23 22:38:41 Re: v7.2.2 Released ... but not announced ...
Previous Message Tom Lane 2002-08-23 22:01:38 Re: Permissions for CREATE OPERATOR CLASS

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2002-08-23 23:08:21 (yet) more buffer paranoia
Previous Message Barry Lind 2002-08-23 19:55:47 Re: prepare patch