Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y3S11-0005ar-Kp for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2014 16:08:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y3S11-0003Dz-48 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2014 16:08:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y3S0z-0003BO-47 for pgsql-hackers@postgresql.org; Tue, 23 Dec 2014 16:08:53 +0000 Received: from outmail149077.authsmtp.com ([62.13.149.77]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y3S0u-0001Ks-HF for pgsql-hackers@postgresql.org; Tue, 23 Dec 2014 16:08:51 +0000 Received: from mail-c237.authsmtp.com (mail-c237.authsmtp.com [62.13.128.237]) by punt15.authsmtp.com (8.14.2/8.14.2/) with ESMTP id sBNG8iuE088386; Tue, 23 Dec 2014 16:08:44 GMT Received: from alvin.alvh.no-ip.org (client-186-37-21-85.imovil.entelpcs.cl [186.37.21.85] (may be forged)) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id sBNG8d1H017785; Tue, 23 Dec 2014 16:08:42 GMT Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id E5A6A7AD; Tue, 23 Dec 2014 13:08:51 -0300 (CLST) Date: Tue, 23 Dec 2014 13:08:51 -0300 From: Alvaro Herrera To: =?iso-8859-1?Q?Jos=E9_Luis_Tall=F3n?= Cc: Andres Freund , pgsql-hackers@postgresql.org, "'Robert Haas'" , Tom Lane Subject: Re: [COMMITTERS] pgsql: Use a bitmask to represent role attributes Message-ID: <20141223160851.GP1768@alvh.no-ip.org> References: <31247.1419347882@sss.pgh.pa.us> <20141223152630.GM1768@alvh.no-ip.org> <20141223154611.GE32020@awork2.anarazel.de> <549991AB.1060504@adv-solutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <549991AB.1060504@adv-solutions.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Server-Quench: f731b526-8abd-11e4-9f74-002590a135d3 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZcSBoa BzkeAQdJTRslYBtL RB4bawxAL0wMSABN M15eIxoOcUtGHhZ1 VjUUWVRVVE1wX2l1 YwBVb0tcakxQXAJ0 UklXSldNEQ1vHhxP RWxgJREmdn1GeXl3 bUMsX3JTXUE0I0F+ QxxRF2sbbTYyPH0e URVcagoCdwdXfh9H b1l/BXIOZDEEKBg1 TUcAHxkaHhhlExEd cSoqCHczfXomJAUJ DwgNBiwrTwU4XCh7 JlQsK0IZFV0Selk1 eUEsQUgVKBIUFkVE GEVAYmdQO0UbRiA2 EQ5BNQAA X-Authentic-SMTP: 61633235383639.1024:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 186.37.21.85/587 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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