X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 98E51DA35D for ; Thu, 6 Oct 2005 10:33:11 -0300 (ADT) 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 07781-06 for ; Thu, 6 Oct 2005 13:33:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 87627D9654 for ; Thu, 6 Oct 2005 10:33:06 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j96DX9tB016714; Thu, 6 Oct 2005 09:33:09 -0400 (EDT) To: "Stewart Ben (RBAU/EQS4) *" Cc: pgsql-sql@postgresql.org Subject: Re: Scripting GRANT on functions In-reply-to: References: Comments: In-reply-to "Stewart Ben (RBAU/EQS4) *" message dated "Thu, 06 Oct 2005 15:27:25 +1000" Date: Thu, 06 Oct 2005 09:33:09 -0400 Message-ID: <16713.1128605589@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200510/54 X-Sequence-Number: 22907 "Stewart Ben (RBAU/EQS4) *" writes: > Is there any easy way to script granting privileges to a number of > functions? I've got as far as the following code before realising that > I'll need to pass in the arguments, and the arguments are stored as OIDs > in pg_proc. > Is there any easy way, such as GRANT .... FUNCTION OID 12345? Coerce the OID to regprocedure to generate a usable name for the function. regression=# select oid from pg_proc limit 5; oid ------ 1242 1243 1244 31 1245 (5 rows) regression=# select oid::regprocedure from pg_proc limit 5; oid ------------------ boolin(cstring) boolout(boolean) byteain(cstring) byteaout(bytea) charin(cstring) (5 rows) regression=# regards, tom lane