MCPcopy Create free account
hub / github.com/apache/cloudberry / equalRuleLocks

Function equalRuleLocks

src/backend/utils/cache/relcache.c:912–950  ·  view source on GitHub ↗

* equalRuleLocks * * Determine whether two RuleLocks are equivalent * * Probably this should be in the rules code someplace... */

Source from the content-addressed store, hash-verified

910 * Probably this should be in the rules code someplace...
911 */
912static bool
913equalRuleLocks(RuleLock *rlock1, RuleLock *rlock2)
914{
915 int i;
916
917 /*
918 * As of 7.3 we assume the rule ordering is repeatable, because
919 * RelationBuildRuleLock should read 'em in a consistent order. So just
920 * compare corresponding slots.
921 */
922 if (rlock1 != NULL)
923 {
924 if (rlock2 == NULL)
925 return false;
926 if (rlock1->numLocks != rlock2->numLocks)
927 return false;
928 for (i = 0; i < rlock1->numLocks; i++)
929 {
930 RewriteRule *rule1 = rlock1->rules[i];
931 RewriteRule *rule2 = rlock2->rules[i];
932
933 if (rule1->ruleId != rule2->ruleId)
934 return false;
935 if (rule1->event != rule2->event)
936 return false;
937 if (rule1->enabled != rule2->enabled)
938 return false;
939 if (rule1->isInstead != rule2->isInstead)
940 return false;
941 if (!equal(rule1->qual, rule2->qual))
942 return false;
943 if (!equal(rule1->actions, rule2->actions))
944 return false;
945 }
946 }
947 else if (rlock2 != NULL)
948 return false;
949 return true;
950}
951
952/*
953 * equalPolicy

Callers 1

RelationClearRelationFunction · 0.85

Calls 1

equalFunction · 0.85

Tested by

no test coverage detected