Re: 8.1 removed functions - Mailing list pgsql-general

From nielsgron@gmail.com
Subject Re: 8.1 removed functions
Date
Msg-id 1135820087.586504.32950@f14g2000cwb.googlegroups.com
Whole thread Raw
In response to 8.1 removed functions  (Андрей <andyk@softwarium.net>)
Responses Re: 8.1 removed functions
List pgsql-general
Hi Tom,

With PG 8.0 I was using a query using makeaclitem() and aclcontains()
to extract permissions.  Here is a sample query for database
permissions ...

SELECT
    ((grantee.name)::character varying)    AS grantee,
    ((nc.datname)::character varying)     AS database,
    (pr."type")                        AS privilege_type,
    (
    CASE
        WHEN aclcontains(nc.datacl, makeaclitem(grantee.usesysid,
grantee.grosysid, u_grantor.usesysid, pr."type", true))
        THEN 'YES'::text
        ELSE 'NO'::text
    END)                                                AS is_grantable,
    ('NO')                              AS with_hierarchy
FROM
    pg_database nc,
    pg_user u_grantor,
    (((((    SELECT pg_user.usesysid, 0, pg_user.usename  FROM pg_user )
          UNION ALL
         ( SELECT 0, pg_group.grosysid, pg_group.groname  FROM pg_group
          )
    )) UNION ALL (    SELECT 0, 0, 'PUBLIC' ) )) grantee(usesysid, grosysid,
name),
    (((((    SELECT 'CREATE' ) UNION ALL (    SELECT 'TEMP' ) )) UNION ALL (
SELECT 'USAGE' ) )) pr("type")
WHERE
    aclcontains(nc.datacl, makeaclitem(grantee.usesysid, grantee.grosysid,
u_grantor.usesysid, pr."type", false))
    AND (grantee.name = 'postgres'::name)


What is the recommended manner to extract object permissions for 8.1
now that these functions are not available?

regards,
-Niels


pgsql-general by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: windows xp install problem ("failed to set permissions on the installed files...")
Next
From: dhilchrist@gmail.com
Date:
Subject: Check If PostgreSQL Table Exists