X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C8081535AC for ; Sun, 27 Mar 2005 16:31:25 +0100 (BST) 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 41929-05 for ; Sun, 27 Mar 2005 15:31:21 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 03A2253493 for ; Sun, 27 Mar 2005 16:31:20 +0100 (BST) Received: (qmail 9449 invoked by uid 500); 27 Mar 2005 15:47:56 -0000 Date: Sun, 27 Mar 2005 09:47:56 -0600 From: Bruno Wolff III To: Rajarshi Mukherjee Cc: pgsql-admin@postgresql.org Subject: Re: grant problem Message-ID: <20050327154756.GB9280@wolff.to> Mail-Followup-To: Bruno Wolff III , Rajarshi Mukherjee , pgsql-admin@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.411 tagged_above=0 required=5 tests=AWL, DEAR_SOMETHING X-Spam-Level: X-Archive-Number: 200503/443 X-Sequence-Number: 16941 On Tue, Mar 22, 2005 at 11:22:07 +0530, Rajarshi Mukherjee wrote: > Dear Sir/Madam, > > I have a problem regarding grants in PG. It is as follows: > > I wanted to grant execute on a function that updates a table. > But i got an ERROR: permission denied for relation > > Now i don't want to grant update on that table as i want all updates > to be done through the function, and no one should be able to update > it manually. > > How can i achieve that? Grant UPDATE access to the table to the owner of the function, create the function with the SECURITY DEFINER access and give EXECUTE access (you will want to revoke EXECUTE from public as that is the default for functions) to the function to the users that should be able to use it.