Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2023-02-23T23:20:05Z
Lists: pgsql-bugs
Attachments
- add-lateral-markers.patch (text/x-patch) patch
On Thu, 23 Feb 2023 at 21:50, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > It looks to me like the rewriter is failing to set the rte->lateral flag > on the sub-select, or maybe the fault is even earlier in the parser. > > Arguably, the user should have written LATERAL on that sub-select in > the first place, but we probably can't start enforcing that ex post > facto. We'll have to do something that causes NEW (and OLD?) references > in sub-selects to generate a LATERAL marking silently. > Yeah, my first thought was to try to fix it up in the rewriter, so that it can deal with any existing stored rules. Doing the attached fixes the reported issue, and all variants of it that I could come up with, but I'm not entirely sure whether it needs to be concerned about other rtekinds. Regards, Dean
Commits
-
Fix mishandling of OLD/NEW references in subqueries in rule actions.
- 79f194cc0144 11.20 landed
- 4fd093af7186 12.15 landed
- 39ad791e8510 13.11 landed
- 27ff93d18c2b 14.8 landed
- 8e5b4e0013a8 15.3 landed
- a7d71c41dbd6 16.0 landed
-
Fix multi-row DEFAULT handling for INSERT ... SELECT rules.
- e68b133c30e2 11.20 landed
- 98b83b734982 12.15 landed
- 226da3d47670 13.11 landed
- f0423bea7f0a 14.8 landed
- 940b5474365f 15.3 landed
- 75c737636b8a 16.0 landed
-
Fix DEFAULT-handling in multi-row VALUES lists for updatable views.
- 41531e42d34f 12.0 cited