pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oli Sennhauser <oli.sennhauser@bluewin.ch>
To: pgsql-admin@postgresql.org
Subject: CREATE USER system privilege?
Date: Mon, 22 Dec 2003 12:07:35 +0100
Message-ID: <3FE6D077.7000403@bluewin.ch> (raw)

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





view thread (5+ messages)  latest in thread

Message-ID: <3FE6D077.7000403@bluewin.ch>
Permalink:  ../3FE6D077.7000403@bluewin.ch/
Also on:    postgresql.org/message-id/3FE6D077.7000403@bluewin.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: oli.sennhauser@bluewin.ch
  Subject: Re: CREATE USER system privilege?
  In-Reply-To: <3FE6D077.7000403@bluewin.ch>
  References: <3FE6D077.7000403@bluewin.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox