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

Commit10021fa

Browse files
committed
reset per_table_parenthood_mapping completely in case of error
1 parent989092c commit10021fa

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

‎src/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
472472
ExecuteForPlanTree(result,add_partition_filters);
473473

474474
/* Decrement parenthood_statuses refcount */
475-
decr_refcount_parenthood_statuses();
475+
decr_refcount_parenthood_statuses(false);
476476

477477
/* HACK: restore queryId set by pg_stat_statements */
478478
result->queryId=query_id;

‎src/planner_tree_modification.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ assign_rel_parenthood_status(uint32 query_id,
538538
/* Saved status conflicts with 'new_status' */
539539
if (status_entry->parenthood_status!=new_status)
540540
{
541-
/* Don't forget to clearall lists! */
542-
decr_refcount_parenthood_statuses();
541+
/* Don't forget to clearALL tracked statuses! */
542+
decr_refcount_parenthood_statuses(true);
543543

544544
elog(ERROR,"It is prohibited to apply ONLY modifier to partitioned "
545545
"tables which have already been mentioned without ONLY");
@@ -592,10 +592,15 @@ incr_refcount_parenthood_statuses(void)
592592

593593
/* Reset all cached statuses if needed (query end) */
594594
void
595-
decr_refcount_parenthood_statuses(void)
595+
decr_refcount_parenthood_statuses(boolentirely)
596596
{
597597
Assert(per_table_parenthood_mapping_refcount>0);
598-
per_table_parenthood_mapping_refcount--;
598+
599+
/* Should we destroy the table right now? */
600+
if (entirely)
601+
per_table_parenthood_mapping_refcount=0;
602+
else
603+
per_table_parenthood_mapping_refcount--;
599604

600605
/* Free resources if no one is using them */
601606
if (per_table_parenthood_mapping_refcount==0)

‎src/planner_tree_modification.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void assign_rel_parenthood_status(uint32 query_id, Oid relid,
4545
rel_parenthood_statusnew_status);
4646
rel_parenthood_statusget_rel_parenthood_status(uint32query_id,Oidrelid);
4747
voidincr_refcount_parenthood_statuses(void);
48-
voiddecr_refcount_parenthood_statuses(void);
48+
voiddecr_refcount_parenthood_statuses(boolentirely);
4949

5050

5151
#endif/* PLANNER_TREE_MODIFICATION_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp