Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-02-22T08:00:01Z
Lists: pgsql-bugs
21.02.2023 21:02, Tom Lane wrote: > Dean Rasheed <dean.a.rasheed@gmail.com> writes: >> Yeah, that makes sense. Something like this? (I think an elog() is >> probably more useful than an Assert(), if we don't find what we >> expect.) > I think it's fine to leave the checks on parsetree->jointree being > a FromExpr as Asserts, because that's assumed in a lot of places. > Rest of it is OK by me. I have a minor question about the condition: + if (pt->commandType == CMD_INSERT ... Is it possible to get another commandType there? IIUC, we cant get into if (defaults_remaining && product_queries != NIL) only for INSERT ... In other words, are there other commands that we expect executing following lines for? values_rte = rt_fetch(values_rte_index, pt->rtable); ... rewriteValuesRTEToNulls(pt, values_rte); (ALSO MERGE is not supported, as I can see) If the (pt->commandType == CMD_INSERT) check is for safety, maybe it should be broader? Thanks for the fix! (My extra testing discovered no new anomalies in this area.) Best regards, Alexander
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