From ef4ef0024c780f3f7b43fec568f215ff8f1a53e8 Mon Sep 17 00:00:00 2001 From: Tim Chang Date: Mon, 8 Jan 2024 05:11:23 +0000 Subject: [PATCH] Minor style fixes Signed-off-by: Tim Chang --- src/backend/access/transam/varsup.c | 4 +--- src/backend/catalog/catalog.c | 16 ++-------------- src/backend/catalog/index.c | 6 +----- src/backend/catalog/toasting.c | 4 ---- src/include/utils/rel.h | 1 - 5 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index ef98e96bc86..2e8ff509dc2 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -33,9 +33,6 @@ /* Number of OIDs to prefetch (preallocate) per XLOG write */ #define VAR_OID_PREFETCH 8192 -#define OID_TO_BUFFER_START(oid) ((oid) + INT_MIN) -#define BUFFER_START_TO_OID ((Oid) (temp_oid_buffer_start) - INT_MIN) - /* pointer to "variable cache" in shared memory (set up by shmem.c) */ VariableCache ShmemVariableCache = NULL; @@ -520,6 +517,7 @@ ForceTransactionIdLimitUpdate(void) return false; } + /* * GetNewObjectId -- allocate a new OID * diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index fb0bbef62e2..17ee2b22954 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -565,29 +565,21 @@ GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence) /* Generate the OID */ if (pg_class) { + /* Temp tables use temp OID logic */ if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && GetNewTempOidWithIndex_hook && temp_oid_buffer_size > 0) - { - /* Temp tables use temp OID logic */ rnode.node.relNode = GetNewTempOidWithIndex_hook(pg_class, ClassOidIndexId, Anum_pg_class_oid); - } else - { rnode.node.relNode = GetNewOidWithIndex(pg_class, ClassOidIndexId, Anum_pg_class_oid); - } } else { + /* Temp tables use temp OID logic */ if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && GetNewTempObjectId_hook && temp_oid_buffer_size > 0) - { - /* Temp tables use temp OID logic */ rnode.node.relNode = GetNewTempObjectId_hook(); - } else - { rnode.node.relNode = GetNewObjectId(); - } } /* Check for existing file of same name */ @@ -611,15 +603,11 @@ GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence) } if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && tries > temp_oid_buffer_size) - { ereport(ERROR, (errmsg("Unable to allocate oid for temp table. Drop some temporary tables or start a new session."))); - } else if (relpersistence == RELPERSISTENCE_TEMP && sql_dialect == SQL_DIALECT_TSQL && tries >= (0.8 * temp_oid_buffer_size)) - { ereport(WARNING, (errmsg("Temp object OID usage is over 80%%. Consider dropping some temp tables or starting a new session."))); - } pfree(rpath); tries++; diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index d6de0ea7a00..10a5f6d0c08 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -950,16 +950,12 @@ index_create(Relation heapRelation, } else { + /* Index OIDs must be kept in normal OID range. */ if (is_enr && GetNewPermanentRelFileNode_hook) - { - /* Index OIDs must be kept in normal OID range. */ indexRelationId = GetNewPermanentRelFileNode_hook(tableSpaceId, pg_class, relpersistence); - } else - { indexRelationId = GetNewRelFileNode(tableSpaceId, pg_class, relpersistence); - } } } diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c index 6fa36b7b733..4afde261b43 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -199,13 +199,9 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, * Create the toast table and its index */ if (sql_dialect == SQL_DIALECT_TSQL && RelationIsBBFTableVariable(rel)) - { pg_toast_prefix = "@pg_toast"; - } else if (sql_dialect == SQL_DIALECT_TSQL && rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP && get_ENR_withoid(currentQueryEnv, rel->rd_id, ENR_TSQL_TEMP)) - { pg_toast_prefix = "#pg_toast"; - } snprintf(toast_relname, sizeof(toast_relname), "%s_%u", pg_toast_prefix, relOid); diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index be030d0f947..659be74fe77 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -701,4 +701,3 @@ extern void RelationDecrementReferenceCount(Relation rel); (relation)->rd_rel->relname.data[0] == '@') #endif /* REL_H */ -