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 22B76DA2EB for ; Thu, 6 Oct 2005 02:27:36 -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 76423-02 for ; Thu, 6 Oct 2005 05:27:32 +0000 (GMT) Received: from smtp-v.fe.bosch.de (smtp-v.fe.bosch.de [139.15.237.2]) by svr1.postgresql.org (Postfix) with ESMTP id C2C7ED9966 for ; Thu, 6 Oct 2005 02:27:31 -0300 (ADT) Received: from mta2.fe.internet.bosch.com (unknown [10.4.98.30]) by imta7.fe.bosch.de (Postfix) with ESMTP id 87FE13C01B for ; Thu, 6 Oct 2005 07:27:29 +0200 (CEST) Received: from mailgate.cl.internet.bosch.com (virusscan6.fe.internet.bosch.com [10.4.98.11]) by mta2.fe.internet.bosch.com (Postfix) with ESMTP id AE7158C09E for ; Thu, 6 Oct 2005 07:27:28 +0200 (CEST) Received: from cl-mail01.au.bosch.com (unknown [10.23.5.53]) by mailgate.cl.internet.bosch.com (Postfix) with ESMTP id 867045282E for ; Thu, 6 Oct 2005 15:27:26 +1000 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Scripting GRANT on functions Date: Thu, 6 Oct 2005 15:27:25 +1000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Scripting GRANT on functions Thread-Index: AcXKNqLUqDy69ncHSkWbpXF4kQTAdA== From: "Stewart Ben (RBAU/EQS4) *" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.574 required=5 tests=[AWL=-0.007, DNS_FROM_RFC_ABUSE=0.374, UPPERCASE_25_50=0.207] X-Spam-Level: X-Archive-Number: 200510/46 X-Sequence-Number: 22899 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? ---CODE--- DECLARE curs REFCURSOR; funcname VARCHAR; BEGIN OPEN foo FOR SELECT proname FROM pg_proc WHERE proname LIKE 'tr\\_%' OR proname LIKE 'tt\\_%' OR proname LIKE 'v\\_%' OR proname LIKE 'vui\\_%'; FETCH curs INTO funcname; WHILE FOUND LOOP FETCH curs INTO funcname; EXECUTE 'GRANT EXECUTE ON FUNCTION ' || funcname || ' TO myuser'; END LOOP; CLOSE curs; END; ---END CODE--- Best regards, Ben Stewart -- Robert Bosch (Australia) Pty. Ltd. Engineering Quality Services, Software Engineer (RBAU/EQS4) Locked Bag 66 - Clayton South, VIC 3169 - AUSTRALIA mailto:ben.stewart@au.bosch.com http://www.bosch.com.au/