Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-03-02 Thread Wayne Cuddy
On Thu, Feb 28, 2013 at 06:02:05PM +, Ben Morrow wrote: Quoth m...@summersault.com (Mark Stosberg): 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

Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-03-02 Thread Ben Morrow
Quoth lists-pg...@useunix.net (Wayne Cuddy): On Thu, Feb 28, 2013 at 06:02:05PM +, Ben Morrow wrote: (If you wanted to you could instead rename the table, and use rules on the view to transform DELETE to UPDATE SET state = 'deleted' and copy across INSERT and UPDATE...) Sorry to

[SQL] Need help revoking access WHERE state = 'deleted'

2013-02-28 Thread Mark Stosberg
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

Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-02-28 Thread Ben Morrow
Quoth m...@summersault.com (Mark Stosberg): 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

Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-02-28 Thread Mark Stosberg
On 02/28/2013 01:02 PM, Ben Morrow wrote: Quoth m...@summersault.com (Mark Stosberg): 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

Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-02-28 Thread Tom Lane
Mark Stosberg m...@summersault.com writes: # Explicitly grant access to the view. db= grant select on entities_not_deleted to myuser; GRANT # Try again to use the view. Still fails db= SELECT 1 FROM entities_not_deleted WHERE some_col = 'y'; ERROR: permission denied for relation entities

Re: [SQL] Need help revoking access WHERE state = 'deleted'

2013-02-28 Thread Mark Stosberg
On 02/28/2013 02:08 PM, Tom Lane wrote: Mark Stosberg m...@summersault.com writes: # Explicitly grant access to the view. db= grant select on entities_not_deleted to myuser; GRANT # Try again to use the view. Still fails db= SELECT 1 FROM entities_not_deleted WHERE some_col = 'y'; ERROR: