pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Recursive SELECT problem
3+ messages / 2 participants
[nested] [flat]

* Recursive SELECT problem
@ 2006-05-17 10:42 Dave Page <dpage@vale-housing.co.uk>
  2006-05-17 14:06 ` Re: Recursive SELECT problem Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Dave Page @ 2006-05-17 10:42 UTC (permalink / raw)
  To: 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.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Recursive SELECT problem
  2006-05-17 10:42 Recursive SELECT problem Dave Page <dpage@vale-housing.co.uk>
@ 2006-05-17 14:06 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2006-05-17 14:06 UTC (permalink / raw)
  To: Dave Page <dpage@vale-housing.co.uk>; +Cc: pgsql-sql

"Dave Page" <dpage@vale-housing.co.uk> writes:
> 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.

Those privileges don't inherit, so I'm not sure why you need a recursive
check.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Recursive SELECT problem
@ 2006-05-17 14:10 Dave Page <dpage@vale-housing.co.uk>
  0 siblings, 0 replies; 3+ messages in thread

From: Dave Page @ 2006-05-17 14:10 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

 

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us] 
> Sent: 17 May 2006 15:07
> To: Dave Page
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Recursive SELECT problem 
> 
> "Dave Page" <dpage@vale-housing.co.uk> writes:
> > 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.
> 
> Those privileges don't inherit, so I'm not sure why you need 
> a recursive check.

Because I didn't realise they didn't inherit 'cos I missed the note at
the bottom of the CREATE ROLE page :-)

Thanks - that makes life significantly easier!

Regards, Dave.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-05-17 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-17 10:42 Recursive SELECT problem Dave Page <dpage@vale-housing.co.uk>
2006-05-17 14:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-05-17 14:10 Re: Recursive SELECT problem Dave Page <dpage@vale-housing.co.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox