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

Commit91143c0

Browse files
committed
Add invariants check to get_useful_group_keys_orderings()
This commit introduces invariants checking of generated orderingsin get_useful_group_keys_orderings() for assert-enabled builds.Discussion:https://postgr.es/m/a663f0f6-cbf6-49aa-af2e-234dc6768a07%40postgrespro.ruReported-by: Tom LaneAuthor: Andrei LepikhovReviewed-by: Alexander Korotkov, Pavel Borisov
1 parent199012a commit91143c0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

‎src/backend/optimizer/path/pathkeys.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,34 @@ get_useful_group_keys_orderings(PlannerInfo *root, Path *path)
561561
}
562562
}
563563

564+
#ifdefUSE_ASSERT_CHECKING
565+
{
566+
PathKeyInfo*pinfo=linitial_node(PathKeyInfo,infos);
567+
ListCell*lc;
568+
569+
/* Test consistency of info structures */
570+
for_each_from(lc,infos,1)
571+
{
572+
ListCell*lc1,
573+
*lc2;
574+
575+
info=lfirst_node(PathKeyInfo,lc);
576+
577+
Assert(list_length(info->clauses)==list_length(pinfo->clauses));
578+
Assert(list_length(info->pathkeys)==list_length(pinfo->pathkeys));
579+
Assert(list_difference(info->clauses,pinfo->clauses)==NIL);
580+
Assert(list_difference_ptr(info->pathkeys,pinfo->pathkeys)==NIL);
581+
582+
forboth(lc1,info->clauses,lc2,info->pathkeys)
583+
{
584+
SortGroupClause*sgc=lfirst_node(SortGroupClause,lc1);
585+
PathKey*pk=lfirst_node(PathKey,lc2);
586+
587+
Assert(pk->pk_eclass->ec_sortref==sgc->tleSortGroupRef);
588+
}
589+
}
590+
}
591+
#endif
564592
returninfos;
565593
}
566594

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp