Re: Another multi-row VALUES bug
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-28T18:52:39Z
Lists: pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes: > A different way to do this, without relying on the contents of the > targetlist, is to note that, while processing a product query, what we > really want to do is ignore any VALUES RTEs from the original query, > since they will have already been processed. There should then never > be more than one VALUES RTE left to process -- the one from the rule > action. > This can be done by exploiting the fact that in product queries, the > rtable always consists of the rtable from the original query followed > by the rtable from the rule action, so we just need to ignore the > right number of RTEs at the start of the rtable. Of course that would > break if we ever changed the way rewriteRuleAction() worked, but at > least it only depends on that one other place in the code, which has > been stable for a long time, so the risk of future breakage seems > managable. This looks like a good solution. I didn't actually test the patch, but it passes an eyeball check. I like the fact that we can verify that we find only one candidate VALUES RTE. regards, tom lane
Commits
-
Fix DEFAULT handling for multi-row INSERT rules.
- 30f9b03a08bd 11.19 landed
- 33f600f0495f 12.14 landed
- 3bed881237b1 13.10 landed
- 2c7ed9f75292 14.7 landed
- c67204db61fa 15.2 landed
- 2605643a3a9d 16.0 landed