Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 5EE23B5DC5F for ; Tue, 25 Oct 2011 00:50:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 53607-08 for ; Tue, 25 Oct 2011 03:50:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-gx0-f174.google.com (mail-gx0-f174.google.com [209.85.161.174]) by mail.postgresql.org (Postfix) with ESMTP id 385E5B5DD14 for ; Tue, 25 Oct 2011 00:50:24 -0300 (ADT) Received: by ggnb1 with SMTP id b1so81085ggn.19 for ; Mon, 24 Oct 2011 20:50:23 -0700 (PDT) Received: by 10.147.157.21 with SMTP id j21mr1464908yao.36.1319514623653; Mon, 24 Oct 2011 20:50:23 -0700 (PDT) Received: from ?IPv6:2001:44b8:6109:9f00:2a0:c9ff:fe6e:ed8f? (2001-44b8-6109-9f00-02a0-c9ff-fe6e-ed8f.static.ipv6.internode.on.net. [2001:44b8:6109:9f00:2a0:c9ff:fe6e:ed8f]) by mx.google.com with ESMTPS id z6sm69245431anf.22.2011.10.24.20.50.20 (version=SSLv3 cipher=OTHER); Mon, 24 Oct 2011 20:50:22 -0700 (PDT) Message-ID: <4EA631F8.1080508@ringerc.id.au> Date: Tue, 25 Oct 2011 11:50:16 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110307 Thunderbird/3.1.9 MIME-Version: 1.0 To: David Johnston CC: =?UTF-8?B?QnJpY2UgQW5kcsOp?= , "pgsql-sql@postgresql.org" Subject: Re: Handling mutliple clients access with views References: <4EA62500.9070000@ringerc.id.au> <34C216F7-8D8D-4F18-A693-AAF922BF6672@yahoo.com> In-Reply-To: <34C216F7-8D8D-4F18-A693-AAF922BF6672@yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201110/68 X-Sequence-Number: 35952 On 25/10/11 11:36, David Johnston wrote: > Except database roles cannot strictly enforce row-level security (i.e., multiple-tenant) which is the goal of this setup. Ah, yes, if theyr'e relying on _row_ level security then that's very much the case. I misread their post as suggesting that they had different tables for different clients, rather than tables that mix different clients' data. Declarative row-level security (row ownership) would be really nice... here's hoping the SELinux work can be extended to support a simpler, OS-agnostic non-SELinux-based row-level RBAC mechanism. I'd still use SET ROLE where possible, and rely on SECURITY DEFINER stored procs in cases where clients' data is mixed in a table so you need to filter it programmatically. Then I'd wrap those procs in a view so they were transparent and looked like tables, so once row-level security is implemented you could switch to that without the app caring. -- Craig Ringer