Re: Consistent segfault in complex query
Andrew Gierth <andrew@tao11.riddles.org.uk>
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kyle Samson <kysamson@tripadvisor.com>,
"pgsql-hackers\@postgresql.org" <pgsql-hackers@postgresql.org>,
Matthew Kelly <mkelly@tripadvisor.com>
Date: 2018-09-13T21:12:03Z
Lists: pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes: >> So I can see exactly where the problem is, but I'm not sure what the >> solution should be. >> EvalPlanQualStart copies the param_exec value list explicitly _not_ >> including the execPlan link, which obviously isn't going to work if >> the value has not been computed yet. Should it be forcing the >> evaluation of initplans that haven't been run yet, or should the EPQ >> scan evaluate them itself from a copy of the plan, or does there >> need to be some way to share state? (having the InitPlan be run more >> than once might be a problem?) Tom> The second of those; what we need is for any referenced InitPlans Tom> to be executed afresh under EPQ rules. (I'm not entirely sure that Tom> an InitPlan could need to see different input tuples under EPQ Tom> than it'd see otherwise, but I'm not sure it couldn't, either.) Obviously you know this code better than I do... but I'm not convinced. Shouldn't the InitPlan pretty much by definition be independent of the tuples being locked/updated? And doesn't executing them again run the risk of getting a different value for other reasons, for example if an initplan is volatile? 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. -- Andrew (irc:RhodiumToad)
Commits
-
Fix failure with initplans used conditionally during EvalPlanQual rechecks.
- f13e2d1cec9b 11.0 landed
- 9b14bbd52c8c 9.5.15 landed
- 99cbbbbd1ddd 10.6 landed
- 8494755109e9 9.4.20 landed
- 591d0ac8858c 9.3.25 landed
- 2a97a0ad34da 9.6.11 landed
- 1f4a920b7309 12.0 landed