pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: José Luis Tallón <jltallon@adv-solutions.net>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Cc: 'Robert Haas' <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: [COMMITTERS] pgsql: Use a bitmask to represent role attributes
Date: Tue, 23 Dec 2014 13:08:51 -0300
Message-ID: <20141223160851.GP1768@alvh.no-ip.org> (raw)
In-Reply-To: <549991AB.1060504@adv-solutions.net>
References: <E1Y3PQG-0006Hc-Ff@gemulon.postgresql.org>
	<31247.1419347882@sss.pgh.pa.us>
	<20141223152630.GM1768@alvh.no-ip.org>
	<CA+TgmoYFf0yx8vZyRt613MuyMgOHTDPrhBdBbR_8C4NgcE=9yw@mail.gmail.com>
	<20141223154611.GE32020@awork2.anarazel.de>
	<549991AB.1060504@adv-solutions.net>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

José Luis Tallón wrote:
> On 12/23/2014 04:46 PM, Andres Freund wrote:

> >I personally would prefer a 'custom' type to represent the
> >permissions. Internally that could very well be current bitmask, but the
> >external representation could be more complex (i.e. some textual
> >representation). That'd make it easy to make the representation wider/more
> >complex if needed.
> 
> Indeed, though this would imply adding a new "bitstring?" type to core
> Postgres.

We already have varlena bitstrings, in the guise of types bit and
varbit.

> Do you have any further input on what this type would look like ? Any
> operators that might be useful? ISTM that this would actually be the
> greatest strength of a type proper (vs. "hardcoded" bit-wise operations in
> core)

I imagine something like the "reg*" types (regclass, regtype etc): on
input you can pass them an OID, or an possibly-qualified object name;
internally they store the OID.  You can cast them to OID to obtain the
numerical value, or just print them out to get the possibly-qualified
name.

In the case at hand, on output you would get the equivalent of the
text[] you get from pg_role_all_attributes(), and you can input it in
the same way or you can input the bitmask; and the underlying storage is
the bitmask.

This doesn't solve the client compatibility break, or the issue that
querying pg_roles is expensive.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (27+ messages)  latest in thread

Message-ID: <20141223160851.GP1768@alvh.no-ip.org>
Permalink:  ../20141223160851.GP1768@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20141223160851.GP1768@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@2ndquadrant.com, jltallon@adv-solutions.net, andres@2ndquadrant.com, pgsql-hackers@postgresql.org, robertmhaas@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: [COMMITTERS] pgsql: Use a bitmask to represent role attributes
  In-Reply-To: <20141223160851.GP1768@alvh.no-ip.org>
  References: <E1Y3PQG-0006Hc-Ff@gemulon.postgresql.org> <31247.1419347882@sss.pgh.pa.us> <20141223152630.GM1768@alvh.no-ip.org> <CA+TgmoYFf0yx8vZyRt613MuyMgOHTDPrhBdBbR_8C4NgcE=9yw@mail.gmail.com> <20141223154611.GE32020@awork2.anarazel.de> <549991AB.1060504@adv-solutions.net> <20141223160851.GP1768@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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