Re: proposal: regrole type?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: regrole type?
Date: 2012-12-25 18:44:14
Message-ID: CAFj8pRBB2Rj9LsK1pZO7UsAMa+gVo+iv=bTbroy3tAsoOnH1+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/12/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> Can we implement REGROLE type, that simplify role name <-> oid transformations?
>
> Why? It's not any more complicated than it is for the other object
> types that lack REGxxx pseudotypes. Generally speaking, we've only
> bothered with pseudotypes for the cases where lookup is not trivial,
> eg because there are search path considerations.

my first motivation was a cosiness, but a second view shows so this
type(s) can be useful:

* It is relative natural - and can simplify and speed up some kind of
queries, because it directly access to cache.

* We can reduce to half lot of functions \df has_* (84 functions)

pg_catalog | pg_has_role | boolean | name, name, text | normal
pg_catalog | pg_has_role | boolean | name, oid, text | normal
pg_catalog | pg_has_role | boolean | name, text | normal
pg_catalog | pg_has_role | boolean | oid, name, text | normal
pg_catalog | pg_has_role | boolean | oid, oid, text | normal
pg_catalog | pg_has_role | boolean | oid, text | normal

these function should be replaced with more semantics descriptive headers

pg_has_role(regrole, regrole, text)
pg_has_role(regrole, text)
pg_has_role(text)

so we can drop (42 functions from catalog)

* this new datatype can be used in custom functions with implicit
validity checking - and if I can sort a importance of some internal
objects - then the roles are relative on high position.

Best regards

Pavel

p.s. A implementation should be little bit harder than I expected due
specific role "public", but I am thinking so it can has a some value.

>
> regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-12-25 18:57:52 Re: proposal: regrole type?
Previous Message Dimitri Fontaine 2012-12-25 18:42:24 Re: Event Triggers: adding information