From 5c745146004e44039598c1136d9f2657bd68cd32 Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Wed, 9 Feb 2022 18:10:47 +0300 Subject: [PATCH] Update tables type check --- src/backend/distributed/commands/type.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/backend/distributed/commands/type.c b/src/backend/distributed/commands/type.c index ecce4cb9f..81727afde 100644 --- a/src/backend/distributed/commands/type.c +++ b/src/backend/distributed/commands/type.c @@ -958,11 +958,16 @@ CreateTypeDDLCommandsIdempotent(const ObjectAddress *typeAddress) return NIL; } - char type = get_typtype(typeAddress->objectId); - char relKind = get_rel_relkind(typeAddress->objectId); + HeapTuple tup = SearchSysCacheCopy1(TYPEOID, ObjectIdGetDatum(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 */ - if (type == TYPTYPE_COMPOSITE && relKind != RELKIND_COMPOSITE_TYPE) + /* Don't send any command if the type is a table's row 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; }