Skip to content

Commit 162078c

Browse files
author
Tanya Gupta
committed
handling for UDT
Signed-off-by: Tanya Gupta <[email protected]>
1 parent ee68f5d commit 162078c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/parser/parse_type.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ)
339339
int32 result;
340340
Oid typmodin;
341341
Oid typbasetype;
342+
Oid basetypeid;
343+
Oid typeoid;
342344
Datum *datums;
343345
int n;
344346
ListCell *l;
@@ -364,13 +366,15 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ)
364366
parser_errposition(pstate, typeName->location)));
365367

366368
typmodin = ((Form_pg_type) GETSTRUCT(typ))->typmodin;
369+
typeoid = ((Form_pg_type) GETSTRUCT(typ))->oid;
367370
typbasetype = ((Form_pg_type) GETSTRUCT(typ))->typbasetype;
371+
basetypeid = getBaseType(typeoid);
368372

369373
if (dump_restore && (strcmp(dump_restore, "on") == 0) && !typmodin && typbasetype)
370374
{
371-
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(typbasetype));
375+
tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(basetypeid));
372376
if (!HeapTupleIsValid(tup)) /* should not happen */
373-
elog(ERROR, "cache lookup failed for type %u", typbasetype);
377+
elog(ERROR, "cache lookup failed for type %u", basetypeid);
374378
typmodin = ((Form_pg_type) GETSTRUCT((Type)tup))->typmodin;
375379
ReleaseSysCache(tup);
376380
}

0 commit comments

Comments
 (0)