1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Allow use of table rowtypes directly as column types of other tables.

Instead of prohibiting that, put code into ALTER TABLE to reject ALTERs
that would affect other tables' columns.  Eventually we will probably
want to extend ALTER TABLE to actually do something useful here, but
in the meantime it seems wrong to forbid the feature completely just
because ALTER isn't fully baked.
This commit is contained in:
Tom Lane
2004-06-06 20:30:07 +00:00
parent 19e3bdd6c7
commit bb3da43e3b
2 changed files with 98 additions and 16 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.268 2004/06/06 04:52:55 tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.269 2004/06/06 20:30:07 tgl Exp $
*
*
* INTERFACE ROUTINES
@@ -416,10 +416,7 @@ CheckAttributeType(const char *attname, Oid atttypid)
* Warn user, but don't fail, if column to be created has UNKNOWN type
* (usually as a result of a 'retrieve into' - jolly)
*
* Refuse any attempt to create a pseudo-type column or one that uses a
* non-standalone composite type. (We could support using table rowtypes
* as attributes, if we were willing to make ALTER TABLE hugely more
* complex, but for now let's limit the damage ...)
* Refuse any attempt to create a pseudo-type column.
*/
if (atttypid == UNKNOWNOID)
ereport(WARNING,
@@ -435,16 +432,6 @@ CheckAttributeType(const char *attname, Oid atttypid)
errmsg("column \"%s\" has pseudo-type %s",
attname, format_type_be(atttypid))));
}
else if (att_typtype == 'c')
{
Oid typrelid = get_typ_typrelid(atttypid);
if (get_rel_relkind(typrelid) != RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("column \"%s\" has composite type %s",
attname, format_type_be(atttypid))));
}
}
/* --------------------------------