Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amhgm-0002NE-5t for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Apr 2016 13:03:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1amhgl-0003a3-Dv for pgsql-bugs@arkaria.postgresql.org; Sun, 03 Apr 2016 13:03:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1amhg7-0002tA-R9 for pgsql-bugs@postgresql.org; Sun, 03 Apr 2016 13:02:55 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1amhfw-0000ZJ-KN for pgsql-bugs@postgresql.org; Sun, 03 Apr 2016 13:02:54 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 4C43A5F795; Sun, 3 Apr 2016 09:02:43 -0400 (EDT) Date: Sun, 3 Apr 2016 09:02:43 -0400 From: Stephen Frost To: Artur Dudnik Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14060: row security policy does not work for updatable views Message-ID: <20160403130243.GM10850@tamriel.snowman.net> References: <20160402200106.2623.11425@wrigleys.postgresql.org> <20160403014006.GK10850@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rTTzD97p2CCc/LGU" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-77-generic (x86_64) X-Uptime: 08:59:34 up 40 days, 9:52, 10 users, load average: 0.19, 0.12, 0.08 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --rTTzD97p2CCc/LGU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Artur, * Artur Dudnik (adudnik@gmail.com) wrote: > > Try creating the view as the 'test' user and you'll see that then acces= sing > the table through the view will result in the RLS policy being applied. >=20 > Sure, you are right. >=20 > Excuse me for stupid question, but may be you will describe how I can > create view for table with restricted access to rows per roles? You can create the view as a role with a restricted set of access, as described. Alternatively, you can create a view owned by a role who has unrestricted access to the table (such as the table owner) and then implement the per-row restrictions there using WHERE and making the view a security barrier view. As with the regular GRANT system, it isn't possible to use the logged-in role to perform access permission checks on a table which is being queried through a view. We may add support for defining policies on views in the future, but that won't be until at least 9.7. Thanks! Stephen --rTTzD97p2CCc/LGU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXARRyAAoJEO1sijiDR2RV4OcQAJsptG/RjRqkQpAXcvPFdmwW f5eHU4R0sulAizWhure6KlOKyNp1uMWawICCv0NWs+caTrZv1/34QPWkVizpjKU5 /fTAobZlA+V/MvlpK3dj8PqIZoCtv3fSUAUxTmdKyf0K1Z4rn6RGuE5FqC0+VcZE VzhrqB7Ix66vr+AlScMaSDoC1WGhjC+8mjb4nqVgqXLB/WviEMB2ww+VL0r+BuqC ltqeXZI1/EbiuP11FDeSpa+BZpAA6ZpDjB1FdP/UEbhhFUJdnU+5zjn4E1W9t6z2 ZLBLDj7xIMdLJhf3glYFZz95a/T+dfrVVB7C6CKvIyAByhVFq9ei4edjxMdkR+i9 buybGflBvEnb6GbodF4qpgoK/ImFmALutwNIREsVbqEl+a0caOflgQS34m/P6pFc ZWf3kwz1LK1rOFMslmFF3ImIvYIRtj68yVaB2jlYSOWWobT1QR30tUC5xufdRvu7 r1flGESOikCCY5efADHq00O27Q6KPz9kxojyI1G5NpgaSEi8Qd6ibGR3Z5+vJ7/6 8OkCEVh0nGiQNbdnGHPiO2GjIzjl9iCH4jZ6NKJYvw+FJgdaUq5PiIxxjQahRfxN B1iJjQhYMmdhddB9wS4uwJ6HAfxmENZ3nHgwrgEvZ2Dr0PUIYkp5WkW+OJtOZyqh b6PXIOxhwjNQ4siY7x1A =IUhC -----END PGP SIGNATURE----- --rTTzD97p2CCc/LGU--