Re: confused by superuser-definition

From: <btober(at)computer(dot)org>
To: <zuhans(at)iname(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: confused by superuser-definition
Date: 2004-06-01 13:05:56
Message-ID: 65124.216.238.112.88.1086095156.squirrel@$HOSTNAME
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> zuhans(at)iname(dot)com wrote:
>> hello,
>>
>> i'm rather new to postgresql and am now standing in front of a big
>> problem.
>>
>> if i want to host my database on any provider out there, i don't now
>> see any chance to get my own right to insert new users into my db.
>> because: i'd only be able to do this, when i had the rights to
>> "createuser", but that would mean, that i'd have the
>> superuser-rights for the whole db's in "public" - if there is only
>> this base-schema.
>>
>> do i understand this right?

No.

-- Function: create_user(name)

CREATE OR REPLACE FUNCTION create_user(name)
RETURNS bool AS
'
DECLARE
PWD VARCHAR;
CMD VARCHAR;
BEGIN
PWD := \'INITIALPWD\';
IF EXISTS(SELECT * FROM pg_user WHERE usename = $1) THEN
RETURN FALSE;
END IF;
CMD := \'CREATE USER "\' || $1 || \'" WITH ENCRYPTED PASSWORD \' || PWD\';
EXECUTE CMD;
RETURN TRUE;
END;
'
LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER;

-- Note: "SECURITY DEFINER". This function was created by a user that
does have create user privileges.

--Berend Tober

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim Seymour 2004-06-01 13:34:51 Re: Running Totals and other stuff....
Previous Message zhicheng wang 2004-06-01 12:53:22 Re: after using pg_resetxlog, db lost