pg_attribute.attisinherited ? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject pg_attribute.attisinherited ?
Date
Msg-id Pine.LNX.4.44.0208231806140.12046-100000@cm-lcon1-46-187.cm.vtr.net
Whole thread Raw
Responses Re: pg_attribute.attisinherited ?
List pgsql-hackers
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
whileprocessing 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)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Permissions for CREATE OPERATOR CLASS
Next
From: Vince Vielhaber
Date:
Subject: Re: v7.2.2 Released ... but not announced ...