* equalRSDesc * * Determine whether two RowSecurityDesc's are equivalent */
| 1001 | * Determine whether two RowSecurityDesc's are equivalent |
| 1002 | */ |
| 1003 | static bool |
| 1004 | equalRSDesc(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 |
no test coverage detected