X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 673E4D1B456 for ; Mon, 22 Dec 2003 10:59:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97947-02 for ; Mon, 22 Dec 2003 06:59:02 -0400 (AST) Received: from mail6.bluewin.ch (mail6.bluewin.ch [195.186.4.229]) by svr1.postgresql.org (Postfix) with ESMTP id 27538D1B4B1 for ; Mon, 22 Dec 2003 06:58:59 -0400 (AST) Received: from bluewin.ch (62.203.91.253) by mail6.bluewin.ch (Bluewin AG 7.0.024) id 3FBC84610043F9C9 for pgsql-admin@postgresql.org; Mon, 22 Dec 2003 10:58:56 +0000 Message-ID: <3FE6D077.7000403@bluewin.ch> Date: Mon, 22 Dec 2003 12:07:35 +0100 From: Oli Sennhauser User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en, de-ch MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: CREATE USER system privilege? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/295 X-Sequence-Number: 11801 Hi I wanted to create a user who can create other users. But this causes some problems: * I did not find any CREATE USER system privilege. So I have to create the first user as Superuser? What I do not want! --> Is this correct? * So I decided to write a function owned by a superuser which can be called by this first user (see below). --> Why does CREATE USER $1 fail??? CREATE USER xyz works. Is this a bug or did I miss something? * Is there realy no other way to execute a stored procedure than SELECT function(); --> I was looking about half an hours into the documents but did not find something like: exec function(); Thanks for tipps Oli CREATE OR REPLACE FUNCTION public.create_user(pg_catalog.pg_user.usename%TYPE) RETURNS varchar AS ' DECLARE ret VARCHAR; BEGIN CREATE USER oli; SELECT INTO ret $1; CREATE USER $1; RETURN ret; END; ' LANGUAGE plpgsql SECURITY DEFINER; ------------------------------------------------------- Oli Sennhauser Database-Engineer (Oracle & PostgreSQL) Rebenweg 6 CH - 8610 Uster / Switzerland Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14 e-Mail oli.sennhauser@bluewin.ch Website http://mypage.bluewin.ch/shinguz/PostgreSQL/ Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID: http://www.swisssign.ch Import the SwissSign Root Certificate: http://swisssign.net/cgi-bin/trust/import