From ddf40b5759d42a221a3d230a540464407f403cf0 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Mon, 18 Dec 2023 10:27:05 +0800 Subject: [PATCH] Fix issues about namespace pg_ext_aux Namespace pg_ext_aux is different from the normal namespace created by the user. It's only used internally. The user isn't allowed to create table in pg_ext_aux explicitly. For temp table, the namespace of the auxiliary table is also pg_ext_aux, not a temp namespace. It seems complicated to distinguish pg_ext_aux and pg_ext_aux_temp. The temp table will be automatically dropped when either the table is dropped or the session is closed. The internal auxiliary relation depends on the table will also automatically dropped if its table is dropped. --- src/backend/catalog/heap.c | 1 + src/backend/utils/cache/relcache.c | 2 +- src/include/catalog/dependency.h | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 11079376ae2..9de81aac317 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -368,6 +368,7 @@ heap_create(const char *relname, if (!allow_system_table_mods && ((IsCatalogNamespace(relnamespace) && relkind != RELKIND_INDEX) || IsToastNamespace(relnamespace) || + IsExtAuxNamespace(relnamespace) || IsAoSegmentNamespace(relnamespace)) && IsNormalProcessingMode()) ereport(ERROR, diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 7ac042ab4fd..1cb10c8d7f5 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -3695,7 +3695,7 @@ RelationBuildLocalRelation(const char *relname, rel->rd_islocaltemp = false; break; case RELPERSISTENCE_TEMP: - Assert(isTempOrTempToastNamespace(relnamespace)); + Assert(relnamespace == PG_EXTAUX_NAMESPACE || isTempOrTempToastNamespace(relnamespace)); rel->rd_backend = BackendIdForTempRelations(); rel->rd_islocaltemp = true; break; diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 2f514b8c05c..a4090f0d2fa 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -142,9 +142,9 @@ typedef enum ObjectClass /* GPDB additions */ OCLASS_PROFILE, /* pg_profile */ - OCLASS_PASSWORDHISTORY, /* pg_password_history */ + OCLASS_PASSWORDHISTORY, /* pg_password_history */ OCLASS_EXTPROTOCOL, /* pg_extprotocol */ - OCLASS_TASK /* pg_task */ + OCLASS_TASK, /* pg_task */ } ObjectClass; #define LAST_OCLASS OCLASS_TASK