Skip to content

Commit

Permalink
Test enr change
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Tanwar <[email protected]>
  • Loading branch information
ritanwar committed Dec 25, 2024
1 parent f424e4d commit 0bd925c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/backend/utils/misc/queryenvironment.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static bool _ENR_tuple_operation(Relation catalog_rel, HeapTuple tup, ENRTupleOp
static void ENRAddUncommittedTupleData(EphemeralNamedRelation enr, Oid catoid, ENRTupleOperationType op, HeapTuple tup, bool in_enr_rollback);
static void ENRDeleteUncommittedTupleData(SubTransactionId subid, EphemeralNamedRelation enr);
static void ENRRollbackUncommittedTuple(QueryEnvironment *queryEnv, ENRUncommittedTuple uncommitted_tup);
static bool IsCatalogOidENR(Oid reloid, bool extended);
static bool IsCatalogRelationENR(Relation rel, bool extended);
static EphemeralNamedRelation find_enr(Form_pg_depend entry);

QueryEnvironment *
Expand Down Expand Up @@ -354,8 +354,9 @@ ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd)
}

/* Simple check to see if the provided OID is the OID of an ENR'd catalog. */
static bool IsCatalogOidENR(Oid reloid, bool extended)
static bool IsCatalogRelationENR(Relation rel, bool extended)
{
Oid reloid = RelationGetRelid(rel);
/* This should always be a catalog relation we're checking. */
if (!IsCatalogRelationOid(reloid))
return false;
Expand Down Expand Up @@ -419,7 +420,7 @@ bool ENRGetSystableScan(Relation rel, Oid indexId, int nkeys, ScanKey key, List
return false;
}

if (!IsCatalogOidENR(reloid, false))
if (!IsCatalogRelationENR(reloid, false))
return false;

switch (nkeys) {
Expand Down Expand Up @@ -837,9 +838,9 @@ static bool _ENR_tuple_operation(Relation catalog_rel, HeapTuple tup, ENRTupleOp
*/
if (op == ENR_OP_ADD)
{
if (!IsCatalogOidENR(tf1->classid, true))
if (!IsCatalogRelationENR(RelationIdGetRelation(tf1->classid), true))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->classid);
else if (!IsCatalogOidENR(tf1->refclassid, true))
else if (!IsCatalogRelationENR(RelationIdGetRelation(tf1->refclassid), true))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->refclassid);
}

Expand Down Expand Up @@ -873,9 +874,9 @@ static bool _ENR_tuple_operation(Relation catalog_rel, HeapTuple tup, ENRTupleOp
*/
if (op == ENR_OP_ADD)
{
if (!IsCatalogOidENR(tf1->classid, true))
if (!IsCatalogRelationENR(RelationIdGetRelation(tf1->classid), true))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->classid);
else if (!IsCatalogOidENR(tf1->refclassid, true))
else if (!IsCatalogRelationENR(RelationIdGetRelation(tf1->refclassid), true))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->refclassid);
}
break;
Expand Down

0 comments on commit 0bd925c

Please sign in to comment.