create roles as normal user

From: Johannes <jotpe(at)posteo(dot)de>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: create roles as normal user
Date: 2016-08-29 05:14:04
Message-ID: 2dc1d081-01c8-646f-e931-b3ad07ea13e8@posteo.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I want a "normal" user to create roles inside the database.
Is it only possible through the createrole privilige, or is there
something like sudo possibile.

I thought it is possible with the security definer option in create
function, but that does not work for me: (In this test the function was
created as superuser).

```sql
CREATE OR REPLACE FUNCTION add_db1_user() returns void language sql
STRICT security definer AS $$
CREATE ROLE db1_testuser login password 'secret';
$$

ERROR: permission denied to create role

Best regards
Johannes

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-08-29 05:35:56 Re: create roles as normal user
Previous Message Pavel Stehule 2016-08-29 05:02:50 Re: a column definition list is required for functions returning "record"