Re: Oversight in reparameterize_path_by_child leading to executor crash
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>,
Andrei Lepikhov <a.lepikhov@postgrespro.ru>, Alena Rybakina <lena.ribackina@yandex.ru>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-02-01T02:54:02Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Postpone reparameterization of paths until create_plan().
- b7e2121ab7d6 17.0 landed
-
Apply band-aid fix for an oversight in reparameterize_path_by_child.
- e031995d5c26 14.11 landed
- 7af96a66f43c 13.14 landed
- 62f120203147 16.2 landed
- 2e822a1d62d0 12.18 landed
- 12ec16d11c8b 15.6 landed
Attachments
- v12-0001-Avoid-reparameterizing-Paths-when-it-s-not-suitable.patch (application/octet-stream) patch v12-0001
On Wed, Jan 31, 2024 at 11:21 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Richard Guo <guofenglinux@gmail.com> writes: > > On Wed, Jan 31, 2024 at 5:12 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > >> * Why is it okay to just use pull_varnos on a tablesample expression, > >> when contain_references_to() does something different? > > > Hmm, the main reason is that the expression_tree_walker() function does > > not handle T_RestrictInfo nodes. So we cannot just use pull_varnos or > > pull_var_clause on a restrictinfo list. > > Right, the extract_actual_clauses step is not wanted for the > tablesample expression. But my point is that surely the handling of > Vars and PlaceHolderVars should be the same, which it's not, and your > v11 makes it even less so. How can it be OK to ignore Vars in the > restrictinfo case? Hmm, in this specific scenario it seems that it's not possible to have Vars in the restrictinfo list that laterally reference the outer join relation; otherwise the clause containing such Vars would not be a restriction clause but rather a join clause. So in v11 I did not check Vars in contain_references_to(). But I agree that we'd better to handle Vars and PlaceHolderVars in the same way. > I think the code structure we need to end up with is a routine that > takes a RestrictInfo-free node tree (and is called directly in the > tablesample case) with a wrapper routine that strips the RestrictInfos > (for use on restriction lists). How about the attached v12 patch? But I'm a little concerned about omitting PVC_RECURSE_AGGREGATES and PVC_RECURSE_WINDOWFUNCS in this case. Is it possible that aggregates or window functions appear in the tablesample expression? Thanks Richard