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: Alexander Lakhin <exclusion@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-bugs@lists.postgresql.org
Date: 2023-02-22T09:07:44Z
Lists: pgsql-bugs
On Wed, 22 Feb 2023 at 08:00, Alexander Lakhin <exclusion@gmail.com> wrote: > > I have a minor question about the condition: > + if (pt->commandType == CMD_INSERT ... > Is it possible to get another commandType there? Yes, there could also be ON INSERT DO ALSO UPDATE/DELETE rules. The new code is intended to apply only for DO ALSO INSERT .. SELECT rules (where the VALUES RTE in "pt" isn't in the usual place), but other types of command in the rule are also possible. As long as the top-level command is a multi-row INSERT ... VALUES (), (), ... it can reach this code block. For something like an ON INSERT DO ALSO UPDATE/DELETE rule, the previous code should in theory handle any remaining DEFAULT values from the top-level INSERT, though I'm not sure how thoroughly that has been tested. I'll take a look. > Thanks for the fix! > (My extra testing discovered no new anomalies in this area.) Thanks for testing. 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