Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 223b813

Browse files
committed
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.
1 parent 7eb2ff7 commit 223b813

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

src/backend/catalog/heap.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.266 2004/05/31 19:24:05 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.267 2004/06/04 03:24:04 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -417,9 +417,9 @@ CheckAttributeType(const char *attname, Oid atttypid)
417417
* (usually as a result of a 'retrieve into' - jolly)
418418
*
419419
* Refuse any attempt to create a pseudo-type column or one that uses a
420-
* standalone composite type. (Eventually we should probably refuse
421-
* all references to complex types, but for now there's still some
422-
* Berkeley-derived code that thinks it can do this...)
420+
* composite type. (Eventually we would like to allow standalone
421+
* composite types, but that needs some nontrivial work yet,
422+
* particularly TOAST support.)
423423
*/
424424
if (atttypid == UNKNOWNOID)
425425
ereport(WARNING,
@@ -437,9 +437,11 @@ CheckAttributeType(const char *attname, Oid atttypid)
437437
}
438438
else if (att_typtype == 'c')
439439
{
440+
#if 0
440441
Oid typrelid = get_typ_typrelid(atttypid);
441442

442-
if (get_rel_relkind(typrelid) == RELKIND_COMPOSITE_TYPE)
443+
if (get_rel_relkind(typrelid) != RELKIND_COMPOSITE_TYPE)
444+
#endif
443445
ereport(ERROR,
444446
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
445447
errmsg("column \"%s\" has composite type %s",

src/backend/parser/analyze.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.302 2004/05/30 23:40:32 neilc Exp $
9+
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.303 2004/06/04 03:24:04 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -3049,23 +3049,10 @@ makeFromExpr(List *fromlist, Node *quals)
30493049
static void
30503050
transformColumnType(ParseState *pstate, ColumnDef *column)
30513051
{
3052-
TypeName *typename = column->typename;
3053-
Type ctype = typenameType(typename);
3054-
30553052
/*
3056-
* Is this the name of a complex type? If so, implement it as a set.
3057-
*
3058-
* XXX this is a hangover from ancient Berkeley code that probably
3059-
* doesn't work anymore anyway.
3053+
* All we really need to do here is verify that the type is valid.
30603054
*/
3061-
if (typeTypeRelid(ctype) != InvalidOid)
3062-
{
3063-
/*
3064-
* (Eventually add in here that the set can only contain one
3065-
* element.)
3066-
*/
3067-
typename->setof = true;
3068-
}
3055+
Type ctype = typenameType(column->typename);
30693056

30703057
ReleaseSysCache(ctype);
30713058
}

0 commit comments

Comments
 (0)