Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aYg4k-0000pG-Hg for pgsql-general@arkaria.postgresql.org; Wed, 24 Feb 2016 20:30:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aYg4j-00017i-FS for pgsql-general@arkaria.postgresql.org; Wed, 24 Feb 2016 20:30:21 +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) (envelope-from ) id 1aYg2S-0006Yk-MA for pgsql-general@postgresql.org; Wed, 24 Feb 2016 20:28:00 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aYg2L-0003b8-E6 for pgsql-general@postgresql.org; Wed, 24 Feb 2016 20:27:59 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 49D1E5F794; Wed, 24 Feb 2016 15:27:51 -0500 (EST) Date: Wed, 24 Feb 2016 15:27:51 -0500 From: Stephen Frost To: Adam Guthrie Cc: pgsql-general@postgresql.org Subject: Re: "plan should not reference subplan's variable" when using row level security Message-ID: <20160224202751.GI3127@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="sl5MdczEF/OU2Miu" 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: 15:03:06 up 1 day, 16:55, 3 users, load average: 0.07, 0.07, 0.12 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --sl5MdczEF/OU2Miu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Adam, * Adam Guthrie (asguthrie@gmail.com) wrote: > psql:/tmp/test.sql:26: ERROR: plan should not reference subplan's variab= le >=20 > Is this a bug or am I doing something wrong? Yeah, looks like a bug to me. My gut reaction is that we're pulling up a subquery in a way that isn't possible and that plan shouldn't be getting built/considered. As a work-around, until we fix it, you could create an sql function to check for the existance of the id in 'a' and use that in the policy definition. Thanks! Stephen --sl5MdczEF/OU2Miu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJWzhJGAAoJEO1sijiDR2RVaz4QAJVSsAgJa5/puH/bQ7MN7rzl AJMI5uTifc6Z5EuQSHG1uPaf0BX89/iy6p0VOmd0uFRje5jZ0g7gBI3+rwTgUDHf 8e2Ku/mOXRetNeql1dvdT1LECxuRHbwNkx5+a6LAsRsCPmxNLQINSDehrkZy7k5+ uf7OOOKHPWr0vf8EF/lCZYV0+1z9s2Y40E4GmmGO3vVTBHAMnS7d9xSLewiqZqwL l9o0m8W2vdbrNwC4EmjtrN1GvCu+FBs8b4bY2bQaq+vN2EYVeL8LWv0P5yXt4Bf4 BmWJbK2dyfDTOcJrqXPbdYY4TEe13n2rsKa5BUYllV2xQpJgPp6syXRibkLEfwDK rmizO+XttnNr4EuXTdvHAISStdDa0L1ysQ6ksXCDM2YuUOMrkA0RWFMNf9H03JeH cfj3A13/GlYiu5UXqZko+IOoiMMMSsIeTlCGyPcXUDSaNdGBnyuP07ryW5hoKlcr qF3jIgGLafqClJzet55KieQ+5VCM+yO+pIaNz5mCLK5ykcJ/vkItINndEeAqgTAu LBVrqdkMfEe+uI2nerf0ToDLr6j6Bnc9Dspe+BELuJ4yz3RQW6ddVZn7/nsAtRRm 4/j7B9v7sqkhKEJ29mrbWn34k/Fi2QSOpPNCuVe/04DcCqJnkUGe+FolWBEWw/jT wGBpS4eBb9ecV5VKpV6u =qqr8 -----END PGP SIGNATURE----- --sl5MdczEF/OU2Miu--