aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/numutils.c
diff options
context:
space:
mode:
authorDean Rasheed <dean.a.rasheed@gmail.com>2022-12-03 12:11:33 +0000
committerDean Rasheed <dean.a.rasheed@gmail.com>2022-12-03 12:11:33 +0000
commit2605643a3a9d789f3a5935810e874c00243d7576 (patch)
tree1de0666a9cb74cc9e54c9c2da1110c2255bb2a54 /src/backend/utils/adt/numutils.c
parentf73bd5fd081187a6515d0f0764730958ad6ba41a (diff)
downloadpostgresql-2605643a3a9d789f3a5935810e874c00243d7576.tar.gz
postgresql-2605643a3a9d789f3a5935810e874c00243d7576.zip
Fix DEFAULT handling for multi-row INSERT rules.
When updating a relation with a rule whose action performed an INSERT from a multi-row VALUES list, the rewriter might skip processing the VALUES list, and therefore fail to replace any DEFAULTs in it. This would lead to an "unrecognized node type" error. The reason was that RewriteQuery() assumed that a query doing an INSERT from a multi-row VALUES list would necessarily only have one item in its fromlist, pointing to the VALUES RTE to read from. That assumption is correct for the original query, but not for product queries produced for rule actions. In such cases, there may be multiple items in the fromlist, possibly including multiple VALUES RTEs. What is required instead is for RewriteQuery() to skip any RTEs from the product query's originating query, which might include one or more already-processed VALUES RTEs. What's left should then include at most one VALUES RTE (from the rule action) to be processed. Patch by me. Thanks to Tom Lane for reviewing. Back-patch to all supported branches. Discussion: https://postgr.es/m/CAEZATCV39OOW7LAR_Xq4i%2BLc1Byux%3DeK3Q%3DHD_pF1o9LBt%3DphA%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/numutils.c')
0 files changed, 0 insertions, 0 deletions