Re: [PATCH] pg_permissions

2022-03-10 Thread Chapman Flack
On 02/26/22 03:27, Joel Jacobson wrote: > On Fri, Feb 25, 2022, at 22:12, Chapman Flack wrote: >> I would be happy to review this patch, but a look through the email leaves me >> thinking it may still be waiting on a C implementation of pg_get_acl(). Is >> that >> right? > > Not sure. It looked

Re: [PATCH] pg_permissions

2022-02-26 Thread Joel Jacobson
On Fri, Feb 25, 2022, at 22:12, Chapman Flack wrote: > I would be happy to review this patch, but a look through the email leaves me > thinking it may still be waiting on a C implementation of pg_get_acl(). Is > that > right? Not sure. > And perhaps a view rename to pg_privileges, following

Re: [PATCH] pg_permissions

2022-02-25 Thread Chapman Flack
I would be happy to review this patch, but a look through the email leaves me thinking it may still be waiting on a C implementation of pg_get_acl(). Is that right? And perhaps a view rename to pg_privileges, following Peter's comment?

Re: [PATCH] pg_permissions

2021-08-31 Thread Peter Eisentraut
On 11.03.21 08:00, Joel Jacobson wrote: Do we prefer "pg_permissions" or "pg_privileges"? pg_privileges would be better. "Permissions" is not an SQL term.

Re: [PATCH] pg_permissions

2021-03-27 Thread Joel Jacobson
On Fri, Mar 26, 2021, at 14:16, Tom Lane wrote: > Alvaro Herrera mailto:alvherre%40alvh.no-ip.org>> > writes: > > On 2021-Mar-26, Joel Jacobson wrote: > >> On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: > >> I wonder what performance will be like with lots o' objects. > > > I guess he is

Re: [PATCH] pg_permissions

2021-03-26 Thread Tom Lane
Alvaro Herrera writes: > On 2021-Mar-26, Joel Jacobson wrote: >> On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: >> I wonder what performance will be like with lots o' objects. > I guess he is concerned about the number of catalog accesses. My concern is basically that you're forcing the join

Re: [PATCH] pg_permissions

2021-03-26 Thread Alvaro Herrera
On 2021-Mar-26, Joel Jacobson wrote: > On Fri, Mar 26, 2021, at 11:30, Alvaro Herrera wrote: > > On 2021-Mar-26, Joel Jacobson wrote: > > > > > On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: > > > > > > I wonder what performance will be like with lots o' objects. > > > > > > I guess

Re: [PATCH] pg_permissions

2021-03-26 Thread Joel Jacobson
On Fri, Mar 26, 2021, at 11:30, Alvaro Herrera wrote: > On 2021-Mar-26, Joel Jacobson wrote: > > > On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: > > > > I wonder what performance will be like with lots o' objects. > > > > I guess pg_get_acl() would need to be implemented using a

Re: [PATCH] pg_permissions

2021-03-26 Thread Alvaro Herrera
On 2021-Mar-26, Joel Jacobson wrote: > On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: > > I wonder what performance will be like with lots o' objects. > > I guess pg_get_acl() would need to be implemented using a switch(classid) > with 36 cases (one for each class)? No, we have a generalized

Re: [PATCH] pg_permissions

2021-03-26 Thread Joel Jacobson
On Fri, Mar 26, 2021, at 07:53, Joel Jacobson wrote: > On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: >> "Joel Jacobson" mailto:joel%40compiler.org>> writes: >> > On Thu, Mar 25, 2021, at 16:16, Alvaro Herrera wrote: >> >> Ah, of course -- the only way to obtain the acl columns is by going >> >>

Re: [PATCH] pg_permissions

2021-03-26 Thread Joel Jacobson
On Thu, Mar 25, 2021, at 17:51, Tom Lane wrote: > "Joel Jacobson" mailto:joel%40compiler.org>> writes: > > On Thu, Mar 25, 2021, at 16:16, Alvaro Herrera wrote: > >> Ah, of course -- the only way to obtain the acl columns is by going > >> through the catalogs individually, so it won't be possible.

Re: [PATCH] pg_permissions

2021-03-25 Thread Tom Lane
"Joel Jacobson" writes: > On Thu, Mar 25, 2021, at 16:16, Alvaro Herrera wrote: >> Ah, of course -- the only way to obtain the acl columns is by going >> through the catalogs individually, so it won't be possible. I think >> this could be fixed with some very simple, quick function pg_get_acl()

Re: [PATCH] pg_permissions

2021-03-25 Thread Joel Jacobson
On Thu, Mar 25, 2021, at 16:16, Alvaro Herrera wrote: > On 2021-Mar-25, Joel Jacobson wrote: > > > pg_shdepend doesn't contain the aclitem info though, > > so it won't work for pg_permissions if we want to expose > > privilege_type, is_grantable and grantor. > > Ah, of course -- the only way to

Re: [PATCH] pg_permissions

2021-03-25 Thread Alvaro Herrera
On 2021-Mar-25, Joel Jacobson wrote: > pg_shdepend doesn't contain the aclitem info though, > so it won't work for pg_permissions if we want to expose > privilege_type, is_grantable and grantor. Ah, of course -- the only way to obtain the acl columns is by going through the catalogs

Re: [PATCH] pg_permissions

2021-03-25 Thread Joel Jacobson
On Tue, Mar 23, 2021, at 21:39, Alvaro Herrera wrote: >I wonder if these views should be defined on top of pg_shdepend instead >of querying every single catalog. That would make for much shorter >queries. +1 pg_shdepend doesn't contain the aclitem info though, so it won't work for

Re: [PATCH] pg_permissions

2021-03-23 Thread Alvaro Herrera
On 2021-Mar-08, Joel Jacobson wrote: > $ dropuser test > dropuser: error: removal of role "test" failed: ERROR: role "test" cannot be > dropped because some objects depend on it > DETAIL: 1 object in database joel > > Hmmm. I wonder which 1 object that could be? BTW the easiest way to find

Re: [PATCH] pg_permissions

2021-03-23 Thread Alvaro Herrera
On 2021-Mar-23, Joel Jacobson wrote: > On Thu, Mar 11, 2021, at 08:00, Joel Jacobson wrote: > > 0004-pg_permissions-and-pg_ownerships.patch > > Having gotten some hands-on experience of these views for a while, > I notice I quite often want to check the ownerships/permissions > for some specific

Re: [PATCH] pg_permissions

2021-03-23 Thread Joel Jacobson
On Thu, Mar 11, 2021, at 08:00, Joel Jacobson wrote: > 0004-pg_permissions-and-pg_ownerships.patch Having gotten some hands-on experience of these views for a while, I notice I quite often want to check the ownerships/permissions for some specific type of objects, or in some specific schema. The

Re: [PATCH] pg_permissions

2021-03-10 Thread Joel Jacobson
New version attached. Changes: * Added documentation in catalogs.sgml * Dropped "objsubid" from pg_ownerships since columns have no owner, only tables Do we prefer "pg_permissions" or "pg_privileges"? I can see "privileges" occur 2325 times in the sources, while "permissions" occur only 1097

Re: [PATCH] pg_permissions

2021-03-09 Thread Joel Jacobson
On Tue, Mar 9, 2021, at 04:01, Chapman Flack wrote: > On Sat, Mar 06, 2021 at 08:03:17PM +0100, Joel Jacobson wrote: > >regclass | obj_desc | grantor | grantee | > privilege_type | is_grantable > > >

Re: [PATCH] pg_permissions

2021-03-09 Thread Chapman Flack
On 03/09/21 11:11, Joel Jacobson wrote: > On Tue, Mar 9, 2021, at 07:34, Joel Jacobson wrote: >> On Tue, Mar 9, 2021, at 04:01, Chapman Flack wrote: >>> 1. Is there a reason not to make 'grantor' and 'grantee' of type regrole? > > Having digested your idea, I actually agree with you. > > Since

Re: [PATCH] pg_permissions

2021-03-09 Thread Joel Jacobson
On Tue, Mar 9, 2021, at 07:34, Joel Jacobson wrote: > On Tue, Mar 9, 2021, at 04:01, Chapman Flack wrote: >> 1. Is there a reason not to make 'grantor' and 'grantee' of type regrole? Having digested your idea, I actually agree with you. Since we have the regrole-type, I agree we should use it,

Re: [PATCH] pg_permissions

2021-03-08 Thread Joel Jacobson
On Tue, Mar 9, 2021, at 04:01, Chapman Flack wrote: > On Sat, Mar 06, 2021 at 08:03:17PM +0100, Joel Jacobson wrote: > >regclass | obj_desc | grantor | grantee | > privilege_type | is_grantable > > >

Re: [PATCH] pg_permissions

2021-03-08 Thread Chapman Flack
On Sat, Mar 06, 2021 at 08:03:17PM +0100, Joel Jacobson wrote: >regclass | obj_desc | grantor | grantee | privilege_type | is_grantable > --+-+-+-++-- 1. Is there a reason not to make

Re: [PATCH] pg_permissions

2021-03-08 Thread Joel Jacobson
On Mon, Mar 8, 2021, at 15:35, Joe Conway wrote: > While this is interesting and probably useful for troubleshooting, it does not > provide the complete picture if what you care about is something like "what > stuff can joel do in my database". Good point, I agree. I think that's a different

Re: [PATCH] pg_permissions

2021-03-08 Thread Joe Conway
On 3/6/21 2:03 PM, Joel Jacobson wrote: > ...but to answer the question... > >    - What permissions are there for a specific role in the database? > > you need to manually query all relevant pg_catalog or > information_schema.*_privileges views, > which is a O(n) mental effort, while the first

Re: [PATCH] pg_permissions

2021-03-07 Thread Joel Jacobson
On Mon, Mar 8, 2021, at 07:28, Joel Jacobson wrote: >Attached is a new patch with both pg_permissions and pg_ownerships in the same >patch, >based on HEAD (8a812e5106c5db50039336288d376a188844e2cc). > >Attachments: >0001-pg_permissions-and-pg_ownerships.patch I forgot to update

Re: [PATCH] pg_permissions

2021-03-07 Thread Joel Jacobson
On Mon, Mar 8, 2021, at 02:09, David Fetter wrote: > +1 for both this and the ownerships view. > > Best, > David. I'm glad you like it. I've put some more effort into this patch, and developed a method to mechanically verify its correctness. Attached is a new patch with both pg_permissions

Re: [PATCH] pg_permissions

2021-03-07 Thread David Fetter
On Sat, Mar 06, 2021 at 08:03:17PM +0100, Joel Jacobson wrote: > Hi, > > It's easy to answer the question... > >- What permissions are there on this specific object? > > ...but to answer the question... > >- What permissions are there for a specific role in the database? > > you need

[PATCH] pg_permissions

2021-03-06 Thread Joel Jacobson
Hi, It's easy to answer the question... - What permissions are there on this specific object? ...but to answer the question... - What permissions are there for a specific role in the database? you need to manually query all relevant pg_catalog or information_schema.*_privileges views,