Re: Consistent segfault in complex query

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyle Samson <kysamson(at)tripadvisor(dot)com>, "pgsql-hackers\(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Matthew Kelly <mkelly(at)tripadvisor(dot)com>
Subject: Re: Consistent segfault in complex query
Date: 2018-09-13 22:12:22
Message-ID: 87sh2dm4zs.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

>> What I'm wondering is whether the param in the copied estate
>> shouldn't rather be just a proxy for the one in the original estate
>> - if we need to evaluate it, then do so in the original estate,
>> store the value there, and copy the value back into the EPQ
>> plantree.

Tom> Don't think that's going to work; the EPQ environment doesn't have
Tom> any way to know that an execPlan link is pointing to something in
Tom> a different estate.

But can't such a way be created? e.g. by pointing execPlan to a special
proxy node that points back to the original estate?

Tom> Your other idea of forcing initPlan parameters to be evaluated
Tom> before we enter the EPQ execution environment is probably more
Tom> workable. It would be annoying to do that for every initPlan in
Tom> sight, but I think we could look at the subplan's extParam to see
Tom> whether it potentially references that parameter. (Although
Tom> really, in most scenarios it wouldn't matter because all the
Tom> initPlans in a data-modifying query are probably referenced in the
Tom> subplan anyhow ...)

Well, the case of UPDATE ... SET foo = case when x then (select thing
from big_cte) else (select thing from other_big_cte) end will be rather
annoying if we end up forcing both initplans to execute.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-09-13 22:18:42 Re: Consistent segfault in complex query
Previous Message Tom Lane 2018-09-13 21:51:20 Re: Consistent segfault in complex query