From: | Raghu Ram <raghuchennuru(at)gmail(dot)com> |
---|---|
To: | "Huang, Suya" <Suya(dot)Huang(at)au(dot)experian(dot)com> |
Cc: | "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: view to get all role privileges |
Date: | 2013-11-07 06:01:50 |
Message-ID: | CALnrrJQk+bcnx-i1RixfmOdSB4Ddiyq6X9qjrhDv_J2GgCwJew@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Thu, Nov 7, 2013 at 11:10 AM, Raghu Ram <raghuchennuru(at)gmail(dot)com> wrote:
> On Thu, Nov 7, 2013 at 10:40 AM, Huang, Suya <Suya(dot)Huang(at)au(dot)experian(dot)com>wrote:
>
>> Hello Ram,
>>
>>
>>
>> The create schema privilege is missed from the dump file.
>>
>>
>>
>
You can get Schema privileges using below function:
postgres=# CREATE OR REPLACE FUNCTION schema_privs(text) RETURNS
table(username text, schemaname name, privieleges text[])
postgres-# AS
postgres-# $$
postgres$# SELECT $1, c.nspname, array(select privs from unnest(ARRAY[
postgres$# ( CASE WHEN has_schema_privilege($1,c.oid,'CREATE') THEN
'CREATE' ELSE NULL END),
postgres$# (CASE WHEN has_schema_privilege($1,c.oid,'USAGE') THEN 'USAGE'
ELSE NULL END)])foo(privs) WHERE privs IS NOT NULL)
postgres$# FROM pg_namespace c where
has_schema_privilege($1,c.oid,'CREATE,USAGE');
postgres$# $$ language sql;
CREATE FUNCTION
postgres=# select schema_privs('postgres');
schema_privs
------------------------------------------------
(postgres,pg_toast,"{CREATE,USAGE}")
(postgres,pg_temp_1,"{CREATE,USAGE}")
(postgres,pg_toast_temp_1,"{CREATE,USAGE}")
(postgres,pg_catalog,"{CREATE,USAGE}")
(postgres,information_schema,"{CREATE,USAGE}")
(postgres,public,"{CREATE,USAGE}")
(6 rows)
Thanks & Regards
Raghu Ram
From | Date | Subject | |
---|---|---|---|
Next Message | Ishaya Bhatt | 2013-11-07 07:15:46 | Datatype of a column |
Previous Message | Raghu Ram | 2013-11-07 05:40:05 | Re: view to get all role privileges |