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

Commit2704b14

Browse files
committed
fixed bogus coding in assign_rel_parenthood_status()
1 parented178ad commit2704b14

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

‎src/planner_tree_modification.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,12 @@ list_member_parenthood(List *list, Oid relid)
504504
status= (cached_parenthood_status*)lfirst(lc);
505505

506506
if (status->relid==relid)
507+
{
508+
/* This should NEVER happen! */
509+
Assert(status->parenthood_status!=PARENTHOOD_NOT_SET);
510+
507511
returnstatus->parenthood_status;
512+
}
508513
}
509514

510515
returnPARENTHOOD_NOT_SET;
@@ -562,23 +567,28 @@ assign_rel_parenthood_status(Index query_level,
562567
/* Search for a parenthood status */
563568
existing_status=list_member_parenthood(nth_parenthood_list,relid);
564569

570+
/* Append new status entry if we couldn't find it */
571+
if (existing_status==PARENTHOOD_NOT_SET)
572+
{
573+
/* Append new element (relid, status) */
574+
old_mcxt=MemoryContextSwitchTo(TopTransactionContext);
575+
nth_parenthood_list=lappend_parenthood(nth_parenthood_list,
576+
relid,new_status);
577+
MemoryContextSwitchTo(old_mcxt);
578+
579+
/* Update ListCell */
580+
lfirst(nth_parenthood_cell)=nth_parenthood_list;
581+
}
582+
565583
/* Parenthood statuses mismatched, emit an ERROR */
566-
if (existing_status!=new_status&&existing_status!=PARENTHOOD_NOT_SET)
584+
elseif (existing_status!=new_status)
567585
{
568586
/* Don't forget to clear all lists! */
569587
reset_parenthood_statuses();
570588

571589
elog(ERROR,"It is prohibited to apply ONLY modifier to partitioned "
572590
"tables which have already been mentioned without ONLY");
573591
}
574-
575-
/* Append new element (relid, status) */
576-
old_mcxt=MemoryContextSwitchTo(TopTransactionContext);
577-
nth_parenthood_list=lappend_parenthood(nth_parenthood_list,relid,new_status);
578-
MemoryContextSwitchTo(old_mcxt);
579-
580-
/* Update ListCell */
581-
lfirst(nth_parenthood_cell)=nth_parenthood_list;
582592
}
583593

584594
/* Get parenthood status (per query level) */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp