X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D0CD5D1B4A9 for ; Wed, 26 Nov 2003 02:21:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 69075-05 for ; Tue, 25 Nov 2003 22:21:26 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 48163D1B49E for ; Tue, 25 Nov 2003 22:21:24 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id hAQ2LNNu029454 for ; Wed, 26 Nov 2003 02:21:23 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id hAQ210fr026805 for pgsql-sql@postgresql.org; Wed, 26 Nov 2003 02:01:00 GMT From: christopher-piker@uiowa.edu (Chris Piker) X-Newsgroups: comp.databases.postgresql.sql Subject: Do update permissions require select permissions Date: 25 Nov 2003 18:00:35 -0800 Organization: http://groups.google.com Lines: 36 Message-ID: <14d07696.0311251800.7f5855b7@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/328 X-Sequence-Number: 16143 I have run across a problem while creating a database with row level permission checking via views and triggers. The just of which is update does not work for a user unless they also have select permissions. Select permissions are handled with a view, while insert, update and delete permissions are handled via triggers. The simplest table which demonstrates the problem is: create table data_t (id int4, stuff text); grant insert,update,delete on data_t to public; As the table creator issue the query: insert into data_t values (1, 'Some stuff'); Now as some other user one can do: update data set stuff = 'other stuff'; And it works okay. But the following fails: update data set stuff = 'yet other stuff' where id = 1; Why is this? The reason that I need to not let the user have select on the table is that they are only allowed to select certian rows and there is a view that takes care of this. For insert update delete there are trigger functions. I know that rules on the view would handle the problem but I am using inheretence and the query plans grow to over 270 rows when rules on views on base tables are put together.