Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 842D19FBCD3 for ; Wed, 18 Jul 2007 11:43:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 97395-01 for ; Wed, 18 Jul 2007 11:42:49 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by postgresql.org (Postfix) with ESMTP id ED12A9FBA29 for ; Wed, 18 Jul 2007 11:42:55 -0300 (ADT) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IBAju-0005ZQ-IG for pgsql-admin@postgresql.org; Wed, 18 Jul 2007 07:42:54 -0700 Message-ID: <11670119.post@talk.nabble.com> Date: Wed, 18 Jul 2007 07:42:54 -0700 (PDT) From: km4hr To: pgsql-admin@postgresql.org Subject: Re: What user privileges do I need to CREATE FUNCTION's? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: km4hr@netscape.net References: <11656315.post@talk.nabble.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.63 tagged_above=0 required=5 tests=BAYES_50=0.001, DNS_FROM_OPENWHOIS=1.13, WHOIS_MYPRIVREG=1.499 X-Spam-Level: ** X-Archive-Number: 200707/206 X-Sequence-Number: 26187 Thanks Milen. Assigning superuser role worked.=20 Speaking of schema's, I logged in as user "postgres" and created a schema called "schema1" as follows: CREATE SCHEMA schema1 AUTHORIZATION newuser; I then typed "\dn" and saw "schema1" in the list. I then logged in as "newuser" and typed "\dn". "schema1" was not in the list! Why not? I then created a table. Next I entered: "select * from schema1.newtable". A= n error message indicated that "schema1" doesn't exist. How do I make "newuser" aware of hi= s new schema? thanks =20 Milen A. Radev-2 wrote: >=20 > km4hr =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0: >> I'm installing an application that provides a ".sql" script to create >> tables >> and other objects in a postgresql database. When I run the script as use= r >> "postgres" the script executes without errors. But then all the tables >> and >> other objects are owned by "postgres". A user that I created to access >> the >> tables, "newuser", doesn't have privileges needed to use them.=20 >>=20 >> If I login as "newuser" and execute the install script, I get errors >> indicating "newuser" doesn't have privileges to CREATE FUNCTION's .=20 >>=20 >> How should I execute the install script so that all the objects are owne= d >> by >> "newuser" and the FUNCTIONS are created? >=20 > You need to create all DB objects with one preferably administrative > role and then GRANT only some privileges to other, everyday roles. > Something like (assuming those are run as a administrator): >=20 > CREATE TABLE example_table ( > id integer PRIMARY KEY, > ... > ); >=20 > REVOKE ALL PRIVILEGES ON TABLE example_table FROM PUBLIC; > GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE example_table TO newuser; >=20 > REVOKE ALL PRIVILEGES ON SEQUENCE example_table_id_seq FROM PUBLIC; > GRANT USAGE ON SEQUENCE example_table_id_seq TO newuser; >=20 >=20 > CREATE FUNCTION example_func(...) RETURNS ... AS $$ > ... > $$ LANGUAGE SQL; >=20 > REVOKE ALL PRIVILEGES ON FUNCTION example_func FROM PUBLIC; > GRANT EXECUTE ON FUNCTION example_func TO newuser; >=20 >=20 >=20 > Or you could change the owner of the newly created DB object: >=20 > ALTER TABLE example_table OWNER TO newuser; > ALTER FUNCTION example_func(...) OWNER TO newuser; >=20 >=20 > This way the new owner has all the privileges on that object. Of > course I prefer the first method of dealing with the needed privileges. >=20 >=20 >> What privileges does "newuser" need to create functions? I can't find >> that >> described in the postgres manual? >=20 > I suppose the role should be the owner of the schema or a superuser. >=20 >=20 > --=20 > Milen A. Radev >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >=20 >=20 --=20 View this message in context: http://www.nabble.com/What-user-privileges-do= -I-need-to-CREATE-FUNCTION%27s--tf4099063.html#a11670119 Sent from the PostgreSQL - admin mailing list archive at Nabble.com.