Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4384ecc

Browse files
committed
Propagate CTE property flags when copying a CTE list into a rule.
rewriteRuleAction() neglected this step, although it was careful topropagate other similar flags such as hasSubLinks or hasRowSecurity.Omitting to transfer hasRecursive is just cosmetic at the moment,but omitting hasModifyingCTE is a live bug, since the executorcertainly looks at that.The proposed test case only fails back to v10, but since the executorexamines hasModifyingCTE in 9.x as well, I suspect that a test casecould be devised that fails in older branches. Given the nearnessof the release deadline, though, I'm not going to spend time lookingfor a better test.Report and patch by Greg Nancarrow, cosmetic changes by meDiscussion:https://postgr.es/m/CAJcOf-fAdj=nDKMsRhQzndm-O13NY4dL6xGcEvdX5Xvbbi0V7g@mail.gmail.com
1 parent5ad0337 commit4384ecc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/backend/rewrite/rewriteHandler.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,9 @@ rewriteRuleAction(Query *parsetree,
504504
*
505505
* This could possibly be fixed by using some sort of internally
506506
* generated ID, instead of names, to link CTE RTEs to their CTEs.
507+
* However, decompiling the results would be quite confusing; note the
508+
* merge of hasRecursive flags below, which could change the apparent
509+
* semantics of such redundantly-named CTEs.
507510
*/
508511
foreach(lc,parsetree->cteList)
509512
{
@@ -525,6 +528,9 @@ rewriteRuleAction(Query *parsetree,
525528
/* OK, it's safe to combine the CTE lists */
526529
sub_action->cteList=list_concat(sub_action->cteList,
527530
copyObject(parsetree->cteList));
531+
/* ... and don't forget about the associated flags */
532+
sub_action->hasRecursive |=parsetree->hasRecursive;
533+
sub_action->hasModifyingCTE |=parsetree->hasModifyingCTE;
528534
}
529535

530536
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp