News for hackers. Stuff that matters.
Re:Hands-On with PostgreSQL Authorization – Part 2 – Row-Lev... by BrandiATMuhkuh on Wednesday March 16, 2022 @04:48PM (#30703881)
Each time I'm reading about RLS in PostgreSQL they leave out how to actually get the `user` into the query.

You need to use

``` SET my.user = 'user1'; SELECT * FROM todos; ```

And in you RLS you can then use

``` CREATE POLICY owner ON todos USING (user = current_setting('my.user')); ```

There are no comments on this comment yet.