diff --git a/citus-tools b/citus-tools deleted file mode 160000 index 3376bd684..000000000 --- a/citus-tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3376bd6845f0614908ed304f5033bd644c82d3bf diff --git a/src/backend/columnar/columnar_metadata.c b/src/backend/columnar/columnar_metadata.c index d67f43a6c..f3c88203c 100644 --- a/src/backend/columnar/columnar_metadata.c +++ b/src/backend/columnar/columnar_metadata.c @@ -2025,23 +2025,24 @@ columnar_relation_storageid(PG_FUNCTION_ARGS) { Oid relationId = PG_GETARG_OID(0); + /* Keep in sync with columnar.storage view filter (exclude other sessions' temps). */ #if PG_VERSION_NUM >= PG_VERSION_18 - /* - * PG18+: avoid relation_open() on other sessions' temp tables. - * Return NULL so callers/views just skip them (function is STRICT). - */ - HeapTuple classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(relationId)); - if (!HeapTupleIsValid(classtup)) - PG_RETURN_NULL(); - Form_pg_class cls = (Form_pg_class) GETSTRUCT(classtup); - if (cls->relpersistence == RELPERSISTENCE_TEMP && - isOtherTempNamespace(cls->relnamespace)) - { - ReleaseSysCache(classtup); - PG_RETURN_NULL(); - } - ReleaseSysCache(classtup); + /* PG18+: avoid relation_open() on other sessions' temp tables. */ + HeapTuple classtup = SearchSysCache1(RELOID, ObjectIdGetDatum(relationId)); + if (!HeapTupleIsValid(classtup)) + { + PG_RETURN_NULL(); /* invalid/gone OID */ + } + Form_pg_class cls = (Form_pg_class) GETSTRUCT(classtup); + bool reject = (cls->relpersistence == RELPERSISTENCE_TEMP) && + isOtherTempNamespace(cls->relnamespace); + ReleaseSysCache(classtup); + + if (reject) + { + PG_RETURN_NULL(); /* function is STRICT; callers just skip */ + } #endif Relation relation = relation_open(relationId, AccessShareLock);