Commit 223b813d authored by Tom Lane's avatar Tom Lane

Remove some long-obsolete code that was causing a strange error message

when someone attempts to create a column of a composite datatype.  For
now, just make sure we produce a reasonable error at the 'right place'.
Not sure if this will be made to work before 7.5, but make it act
reasonably in case nothing more gets done.
parent 7eb2ff79
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.266 2004/05/31 19:24:05 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.267 2004/06/04 03:24:04 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -417,9 +417,9 @@ CheckAttributeType(const char *attname, Oid atttypid) ...@@ -417,9 +417,9 @@ CheckAttributeType(const char *attname, Oid atttypid)
* (usually as a result of a 'retrieve into' - jolly) * (usually as a result of a 'retrieve into' - jolly)
* *
* Refuse any attempt to create a pseudo-type column or one that uses a * Refuse any attempt to create a pseudo-type column or one that uses a
* standalone composite type. (Eventually we should probably refuse * composite type. (Eventually we would like to allow standalone
* all references to complex types, but for now there's still some * composite types, but that needs some nontrivial work yet,
* Berkeley-derived code that thinks it can do this...) * particularly TOAST support.)
*/ */
if (atttypid == UNKNOWNOID) if (atttypid == UNKNOWNOID)
ereport(WARNING, ereport(WARNING,
...@@ -437,9 +437,11 @@ CheckAttributeType(const char *attname, Oid atttypid) ...@@ -437,9 +437,11 @@ CheckAttributeType(const char *attname, Oid atttypid)
} }
else if (att_typtype == 'c') else if (att_typtype == 'c')
{ {
#if 0
Oid typrelid = get_typ_typrelid(atttypid); Oid typrelid = get_typ_typrelid(atttypid);
if (get_rel_relkind(typrelid) == RELKIND_COMPOSITE_TYPE) if (get_rel_relkind(typrelid) != RELKIND_COMPOSITE_TYPE)
#endif
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION), (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("column \"%s\" has composite type %s", errmsg("column \"%s\" has composite type %s",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.302 2004/05/30 23:40:32 neilc Exp $ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.303 2004/06/04 03:24:04 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -3049,23 +3049,10 @@ makeFromExpr(List *fromlist, Node *quals) ...@@ -3049,23 +3049,10 @@ makeFromExpr(List *fromlist, Node *quals)
static void static void
transformColumnType(ParseState *pstate, ColumnDef *column) transformColumnType(ParseState *pstate, ColumnDef *column)
{ {
TypeName *typename = column->typename;
Type ctype = typenameType(typename);
/* /*
* Is this the name of a complex type? If so, implement it as a set. * All we really need to do here is verify that the type is valid.
*
* XXX this is a hangover from ancient Berkeley code that probably
* doesn't work anymore anyway.
*/ */
if (typeTypeRelid(ctype) != InvalidOid) Type ctype = typenameType(column->typename);
{
/*
* (Eventually add in here that the set can only contain one
* element.)
*/
typename->setof = true;
}
ReleaseSysCache(ctype); ReleaseSysCache(ctype);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment