Hacker News new | ask | show | jobs
by bni 3822 days ago
Anyone have ever built an application utilising row level security?

In old-school systems you normally have one database user and a connection pool set up in the app with that user. Row level access is handeld with join tables to sort out what data is accessible for the specific users (sent as parameter to most queries).

With row-level security you would crate a db-user for each application user and also its own connection pool?

2 comments

RLS doesn't require the use of a db user. For example you could use a session variable to identify your logical user and use that in the RLS query.
Connect to db from web app with one user then set role to real user: http://stackoverflow.com/questions/2998597/switch-role-after...

This allows pooling.

I made a quick app with pg 9.5 rc1, rls, spring data rest which I'm hoping to share next week.