Skip to content

Failing to update data because of row level security returns [] as response body #1844

Answered by wolfgangwalther
dshukertjr asked this question in Q&A
Discussion options

You must be logged in to vote

This is just how RLS works. There is no error and it makes sense. RLS limits the number of rows a user can "see" on the table. In your example, you are not seeing any rows - so no rows are updated, there is no error and the result is empty. All correct.

There can be a difference between the rows you are seeing and the rows you are allowed to update. This is the difference between USING and WITH CHECK. Have a look here at Table 272.


On a side note: If you want to do an update where you expect to change exactly one row, not more and not less, you can request a single row via Accept header - see the docs. This would fail in your example, because 0 rows is not "exactly 1 row". Not sure how t…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@dshukertjr
Comment options

@steve-chavez
Comment options

@dshukertjr
Comment options

@wolfgangwalther
Comment options

@steve-chavez
Comment options

Answer selected by wolfgangwalther
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1843 on May 05, 2021 12:40.