chore: add docs

This commit is contained in:
Pepe Fagoaga
2024-12-12 14:28:45 +01:00
parent a0fc4e2692
commit a2e580167a
+4
View File
@@ -78,6 +78,10 @@ class RowLevelSecurityConstraint(models.BaseConstraint):
policy_queries = ""
grant_queries = ""
for statement in self.statements:
# SELECT and DELETE uses USING since applies to rows selected
# INSERT uses WITH CHECK becauseonly applies in cases where records are being added
# UPDATE requires USING and WITH CHECK but if only a USING clause is specified, then that clause will be used for both USING and WITH CHECK cases.
# https://www.postgresql.org/docs/current/sql-createpolicy.html
clause = f"{'WITH CHECK' if statement == 'INSERT' else 'USING'}"
policy_queries = f"{policy_queries}{self.policy_sql_query.format(statement=statement, clause=clause)}"
grant_queries = (