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

Function equalRSDesc

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

* equalRSDesc * * Determine whether two RowSecurityDesc's are equivalent */

Source from the content-addressed store, hash-verified

1001 * Determine whether two RowSecurityDesc's are equivalent
1002 */
1003static bool
1004equalRSDesc(RowSecurityDesc *rsdesc1, RowSecurityDesc *rsdesc2)
1005{
1006 ListCell *lc,
1007 *rc;
1008
1009 if (rsdesc1 == NULL && rsdesc2 == NULL)
1010 return true;
1011
1012 if ((rsdesc1 != NULL && rsdesc2 == NULL) ||
1013 (rsdesc1 == NULL && rsdesc2 != NULL))
1014 return false;
1015
1016 if (list_length(rsdesc1->policies) != list_length(rsdesc2->policies))
1017 return false;
1018
1019 /* RelationBuildRowSecurity should build policies in order */
1020 forboth(lc, rsdesc1->policies, rc, rsdesc2->policies)
1021 {
1022 RowSecurityPolicy *l = (RowSecurityPolicy *) lfirst(lc);
1023 RowSecurityPolicy *r = (RowSecurityPolicy *) lfirst(rc);
1024
1025 if (!equalPolicy(l, r))
1026 return false;
1027 }
1028
1029 return true;
1030}
1031
1032/*
1033 * RelationBuildDesc

Callers 1

RelationClearRelationFunction · 0.85

Calls 3

list_lengthFunction · 0.85
forbothFunction · 0.85
equalPolicyFunction · 0.85

Tested by

no test coverage detected