X-Original-To: pgsql-bugs@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7559347624F for ; Mon, 24 Feb 2003 17:27:41 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 87162-01 for ; Mon, 24 Feb 2003 17:27:13 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id E1593475BD7 for ; Mon, 24 Feb 2003 15:29:18 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id h1OKTI5u005304; Mon, 24 Feb 2003 15:29:18 -0500 (EST) To: "Donald Fraser" Cc: "[BUGS]" Subject: Re: Bugs with rules on views/tables: permission denied In-reply-to: <00cb01c2dc21$12eae290$1664a8c0@DEMOLITION> References: <006001c2dbfc$0cddcfe0$1664a8c0@DEMOLITION> <3150.1046097764@sss.pgh.pa.us> <00cb01c2dc21$12eae290$1664a8c0@DEMOLITION> Comments: In-reply-to "Donald Fraser" message dated "Mon, 24 Feb 2003 16:23:27 +0000" Date: Mon, 24 Feb 2003 15:29:17 -0500 Message-ID: <5303.1046118557@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/125 X-Sequence-Number: 5541 "Donald Fraser" writes: > As USER chkrule do: > Bugs=3D> INSERT INTO vu_tbl_test (id, s_text) VALUES('1','sometext'); > ERROR: vu_tbl_test: permission denied What I get is ERROR: test_func: permission denied and the needed fix is to grant execute privilege on the function to the calling user. > If you give the USER chkrule UPDATE permissions on the view vu_tbl_test the= > n the error at Scenario 1 goes away. Not for me. The reason it acts this way is that rule permissions apply to tables mentioned in the rule, not to functions. This is at least partly for historical reasons: functions didn't have permissions to check, back when the rule system was designed. But I'm not sure that it's wrong. In your example, the end user is controlling the arguments given to test_func. If the rule allowed him to call test_func without having permission to do so, there'd be the potential for security breaches. regards, tom lane