On Fri, Apr 8, 2011 at 5:12 PM, Noah Misch <noah@leadboat.com> wrote:
> Implemented as attached. The first patch just adds the ALTER TABLE subcommands
> to attach and detach a table from a composite type. A few open questions
> concerning typed tables will probably yield minor changes to these subcommands.
> I implemented them to be agnostic toward the outcome of those decisions.
I suppose one issue is whether anyone would care to bikeshed on the
proposed syntax. Any takers?
I think you only need an AccessShareLock on InheritsRelationId, since
you are only selecting from it.
If we adopt the elsewhere-proposed approach of forbidding the use of
rowtypes to create typed tables, the circularity-checking logic here
can become simpler. I think it's not actually water-tight right now:
rhaas=# create table a (x int);
CREATE TABLE
rhaas=# create table b of a;
CREATE TABLE
rhaas=# create table c () inherits (b);
CREATE TABLE
rhaas=# create table d of c;
CREATE TABLE
rhaas=# alter table a of d;
ALTER TABLE
pg_dump is not happy with this situation.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company