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

ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine

From: "Dmitry Koterov" <dmitry(at)koterov(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: ALTER composite type does not work, but ALTER TABLE which ROWTYPE is used as a type - works fine
Date: 2008-12-04 14:53:02
Message-ID: d7df81620812040653l45d61499g4c8f45475afe4e68@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello.

I can successfully ALTER a NON-EMPTY table (ct) which ROWTYPE is used as a
column type for another table (dt):

CREATE TABLE ct (id INTEGER);
CREATE TABLE dt (id INTEGER, c ct);

INSERT INTO dt VALUES(1, '(666)');
SELECT * FROM dt;
-- (1, '(666)')

ALTER TABLE ct ADD COLUMN n INTEGER;
SELECT * FROM dt;
-- (1, '(666,)')

You see, '(666,)' means that the new field is added successfully.


But, if I declare ct as a COMPOSITE type (not a table), it is not permitted
to ALTER this type (Postgres says that there are dependensies on ct).
Why?

Responses

pgsql-hackers by date

Next:From: Devrim GÜNDÜZDate: 2008-12-04 15:19:28
Subject: Can't start postmaster on -HEAD
Previous:From: Alvaro HerreraDate: 2008-12-04 14:51:28
Subject: Re: snapshot leak and core dump with serializabletransactions

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