From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: asguthrie@gmail.com, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13988: "plan should not reference subplan's variable" whilst using row level security
Date: Thu, 25 Feb 2016 19:55:08 -0500
Message-ID: <25223.1456448108@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEZATCW6gyfvjMenAiUyRQbwcu4zUZihUfgm-A_Z36s-g+8Xqg@mail.gmail.com>
References: <20160224210507.2568.85774@wrigleys.postgresql.org>
<20160224214214.GA449452@alvherre.pgsql>
<CAEZATCW6gyfvjMenAiUyRQbwcu4zUZihUfgm-A_Z36s-g+8Xqg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> Debugging it, I have a theory as to the cause of the problem, which I
> think is in security_barrier_replace_vars() --- when it finds a
> matching Var that needs to be added to the targetlist that it is
> building, it copies the existing Var and modifies it:
> /* New variable for subquery targetlist */
> newvar = copyObject(var);
> newvar->varno = newvar->varnoold = 1;
> ...
> However, the Var found comes from a sublink subquery in the outer
> query, and so has varlevelsup = 1, but newvar is for the new subquery
> being built, so it needs to have varlevelsup set to 0, which that code
> fails to do.
Offhand, I'd think it more likely that this code should not be touching
outer-level vars at all? There are few if any situations where it makes
sense to suppose that a Var of one level should be transformed into a Var
of a different level.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, alvherre@2ndquadrant.com
Subject: Re: BUG #13988: "plan should not reference subplan's variable" whilst using row level security
In-Reply-To: <25223.1456448108@sss.pgh.pa.us>
References: <20160224210507.2568.85774@wrigleys.postgresql.org> <20160224214214.GA449452@alvherre.pgsql> <CAEZATCW6gyfvjMenAiUyRQbwcu4zUZihUfgm-A_Z36s-g+8Xqg@mail.gmail.com> <25223.1456448108@sss.pgh.pa.us>
* 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