aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 62d61b315c6..46d9b709398 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.51 2002/11/02 22:02:08 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.51.2.1 2002/12/16 18:39:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -104,7 +104,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
char relname[NAMEDATALEN];
Oid namespaceId;
List *schema = stmt->tableElts;
- int numberOfAttributes;
Oid relationId;
Relation rel;
TupleDesc descriptor;
@@ -147,10 +146,6 @@ DefineRelation(CreateStmt *stmt, char relkind)
stmt->relation->istemp,
&inheritOids, &old_constraints, &parentHasOids);
- numberOfAttributes = length(schema);
- if (numberOfAttributes <= 0)
- elog(ERROR, "DefineRelation: please inherit from a relation or define an attribute");
-
/*
* Create a relation descriptor from the relation schema and create
* the relation. Note that in this stage only inherited (pre-cooked)
@@ -1784,6 +1779,9 @@ AlterTableAddColumn(Oid myrelid,
typeTuple = typenameType(colDef->typename);
tform = (Form_pg_type) GETSTRUCT(typeTuple);
+ /* make sure datatype is legal for a column */
+ CheckAttributeType(colDef->colname, HeapTupleGetOid(typeTuple));
+
attributeTuple = heap_addheader(Natts_pg_attribute,
false,
ATTRIBUTE_TUPLE_SIZE,