Skip to content

Commit

Permalink
Throw an error instead of Assert when checking pg_depend tuples.
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Chang <[email protected]>
  • Loading branch information
timchang514 committed Dec 13, 2024
1 parent 043f242 commit 41b94dc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/backend/utils/misc/queryenvironment.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,8 @@ static bool _ENR_tuple_operation(Relation catalog_rel, HeapTuple tup, ENRTupleOp
* When adding entries to pg_depend, do an additional sanity check
* to verify we aren't creating links to non-ENR catalogs.
*/
if (op == ENR_OP_ADD)
{
Assert(IsENRRelationOid(tf1->classid, true));
Assert(IsENRRelationOid(tf1->refclassid, true));
}
if (op == ENR_OP_ADD && (!IsENRRelationOid(tf1->classid, true) || !IsENRRelationOid(tf1->refclassid, true)))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->classid);

break;
}
Expand Down Expand Up @@ -866,11 +863,8 @@ static bool _ENR_tuple_operation(Relation catalog_rel, HeapTuple tup, ENRTupleOp
* When adding entries to pg_shdepend, do an additional check
* to verify we aren't creating links to non-ENR catalogs.
*/
if (op == ENR_OP_ADD)
{
Assert(IsENRRelationOid(tf1->classid, true));
Assert(IsENRRelationOid(tf1->refclassid, true));
}
if (op == ENR_OP_ADD && (!IsENRRelationOid(tf1->classid, true) || !IsENRRelationOid(tf1->refclassid, true)))
elog(ERROR, "Unexpected catalog OID %d referenced in ENR.", tf1->classid);

break;
}
Expand Down

0 comments on commit 41b94dc

Please sign in to comment.