Re: BUG #17151: A SEGV in optimizer
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: 253540651@qq.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2021-08-19T01:02:44Z
Lists: pgsql-bugs
On Thu, Aug 19, 2021 at 8:24 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > I wrote: > > (This passes check-world, but I've not double-checked to make sure > > that inFromCl will be set in exactly the cases we want.) > > After studying the code a bit more, I remembered why my hindbrain > was feeling uncomfortable about that coding: parsenodes.h says that > inFromCl is quasi-deprecated and not used anymore during parsing. > > However, we can't really use the ParseNamespaceItem data structure > for this purpose, because baserels should be available to lock > whether or not they are visible according to join aliasing rules. > I don't see a lot of point to inventing some complicated add-on > for this when inFromCl will serve fine. So I think we should just > adjust the relevant comments, say like the attached. The patch looks good to me. I've also confirmed that it passed check-world and fixed the problem. > We probably need some regression test cases added (I wonder whether > FOR UPDATE in rule actions is covered at all ATM). Otherwise > I feel like this is OK to commit. +1 for adding at least two queries reported on this thread to regression tests. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/
Commits
-
Avoid trying to lock OLD/NEW in a rule with FOR UPDATE.
- cc7fae5c2d9e 9.6.24 landed
- 2739a281060f 10.19 landed
- fbc1eed8a8dd 11.14 landed
- 8d2d6ec7708b 15.0 landed
- 7fa367d96bb1 13.5 landed
- 464900393352 14.0 landed
- 0c13ee198f0d 12.9 landed