Update tables type check

velioglu/tmpfuncprop
Burak Velioglu 2022-02-09 18:10:47 +03:00
parent 9e938ba1a3
commit 5c74514600
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 9 additions and 4 deletions

View File

@ -958,11 +958,16 @@ CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress)
return NIL; return NIL;
} }
char type = get_typtype(typeAddress->objectId); HeapTuple tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(typeAddress->objectId));
char relKind = get_rel_relkind(typeAddress->objectId); if (!HeapTupleIsValid(tup))
{
elog(ERROR, "cache lookup failed for type %u", typeAddress->objectId);
}
/* Don't send anything if the type is a table's row type */ /* Don't send any command if the type is a table's row type */
if (type == TYPTYPE_COMPOSITE && relKind != RELKIND_COMPOSITE_TYPE) Form_pg_type typTup = (Form_pg_type) GETSTRUCT(tup);
if (typTup->typtype == TYPTYPE_COMPOSITE &&
get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
{ {
return NIL; return NIL;
} }