X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F45D52956 for ; Wed, 23 Mar 2005 19:54:03 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 04347-04 for ; Wed, 23 Mar 2005 19:53:53 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 0AEF15294A for ; Wed, 23 Mar 2005 19:53:52 +0000 (GMT) Received: (qmail 31031 invoked by uid 500); 23 Mar 2005 20:10:16 -0000 Date: Wed, 23 Mar 2005 14:10:16 -0600 From: Bruno Wolff III To: Kathy Smith Cc: pgsql-interfaces@postgresql.org, clittle@lanl.gov Subject: Re: Execute access on functions Message-ID: <20050323201016.GA30776@wolff.to> Mail-Followup-To: Bruno Wolff III , Kathy Smith , pgsql-interfaces@postgresql.org, clittle@lanl.gov References: <6.0.3.0.2.20050323105558.02b80ff8@nis-mail.lanl.gov> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6.0.3.0.2.20050323105558.02b80ff8@nis-mail.lanl.gov> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/69 X-Sequence-Number: 5398 On Wed, Mar 23, 2005 at 12:35:12 -0700, Kathy Smith wrote: > I want to control access (update, delete) to my tables and have done that > with other DBMSs using stored procedures. Besides performance, I believe > that's one of the primary advantages of stored procedures. I grant execute > on the procedure to a group containing the users with controlled update > access. Never on the table. I cannot seem to find the equivalent in > postgres. I had hoped to be able to do this with user-defined functions > but the following statement implies that if the SECURITY DEFINER is used, > that *anyone* who can get to that function can execute it. Hardly the > solution I am looking for. The alternative being that I must grant update > to the table :( > > The CREATE FUNCTION clause SECURITY DEFINER makes the function run with the > privileges of the user who created it. Otherwise, the INVOKER's privileges > are used. > > Am I missing something here? Is there another way? You can control who can execute the function. By default 'public' can execute functions, but you can revoke that access.