Skip to content

Add documentation for row level security#133

Open
ElenaKrippner wants to merge 1 commit intomasterfrom
krippner/rowLevelSecurity
Open

Add documentation for row level security#133
ElenaKrippner wants to merge 1 commit intomasterfrom
krippner/rowLevelSecurity

Conversation

@ElenaKrippner
Copy link
Copy Markdown
Contributor

I'd merge this once we have the release where we announce row level security.

@ElenaKrippner ElenaKrippner force-pushed the krippner/rowLevelSecurity branch from 176079b to 95f7c36 Compare March 12, 2026 08:35
Comment on lines +140 to +145
For upserts, the table needs to be scanned to find the values to update but the policies are applied after finding those values (else, it would be possible to insert values that might have to be updated).

Select policies are also applied on the values of returning clauses of insert, update and delete statements and always on the output of upserts, even if there is no returning clause.

Usually, select policies silently filter the values. This is not the case on the output values of insert, update and upsert statements.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This paragraph I find confusing, but the logic in Postgres is super confusing to begin with so I am not sure we can even do better here...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to rephrase it but I'm not sure if this is better.

#### Update Policies

Update policies can have both an `using` and a `with check` expression.
The `using` expression silently filters the rows that may be updated for update statements, for upserts, an error might be thrown.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `using` expression silently filters the rows that may be updated for update statements, for upserts, an error might be thrown.
The `using` expression silently ignores the rows that may be updated for update statements. For upserts, an error might be thrown.

Why might? Is that not always the case for violating rows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because an error is only thrown if a row would be filtered and not always, but that is probably obvious 😅

@ElenaKrippner ElenaKrippner force-pushed the krippner/rowLevelSecurity branch from 95f7c36 to ef24d4d Compare March 13, 2026 08:29
@ElenaKrippner ElenaKrippner requested a review from ChrisWint March 13, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants