Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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')); ```



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: