Need help revoking access WHERE state = 'deleted' - Mailing list pgsql-sql

From Mark Stosberg
Subject Need help revoking access WHERE state = 'deleted'
Date
Msg-id kgo14h$vm3$1@ger.gmane.org
Whole thread Raw
Responses Re: Need help revoking access WHERE state = 'deleted'  (Ben Morrow <ben@morrow.me.uk>)
List pgsql-sql
We are working on a project to start storing some data as "soft deleted"
(WHERE state = 'deleted') instead of hard-deleting it.

To make sure that we never accidentally expose the deleted rows through
the application, I had the idea to use a view and permissions for this
purpose.

I thought I could revoke SELECT access to the "entities" table, but then
grant SELECT access to a view:
 CREATE VIEW entities_not_deleted AS SELECT * FROM entities WHERE state
!= 'deleted';

We could then find/replace in the code to replace references to the
"entities" table with the "entities_not_deleted" table

However, this isn't working, I "permission denied" when trying to use
the view. (as the same user that has had their SELECT access removed to
the underlying table.)

We are not stuck on this design. What's a recommended way to solve this
problem?
  Mark




pgsql-sql by date:

Previous
From: Marko Rihtar
Date:
Subject: Concatenating bytea types...
Next
From: Ben Morrow
Date:
Subject: Re: Need help revoking access WHERE state = 'deleted'