Recursive SELECT problem

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Recursive SELECT problem
Date: 2006-05-17 10:42:10
Message-ID: E7F85A1B5FF8D44C8A1AF6885BC9A0E40138824D@ratbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I'm trying to write a query to determine whether or not the current
login role has CREATEDB (or CREATEROLE) privileges, either directly or
inherited from a parent role.

The query:

SELECT EXISTS (SELECT 1 FROM pg_authid WHERE rolcreatedb = TRUE AND
pg_has_role(rolname, 'MEMBER')) AS has_createdb

does the job for CREATEDB, except that it doesn't honour rolinherit.
Anyone know how I can do this in pure SQL?

Thanks, Dave.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Niklas Johansson 2006-05-17 10:49:38 Re: Table constraints and INSERT
Previous Message Kis János Tamás 2006-05-17 08:01:06 Re: Database OID