Skip to content

Commit a1e6bd3

Browse files
committed
Merge branch 'master' of github.com:postgrespro/pg_pathman
2 parents 79f3987 + 3d3d9ef commit a1e6bd3

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/pg_pathman.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "utils/guc.h"
3434
#include "utils/lsyscache.h"
3535
#include "utils/selfuncs.h"
36+
#include "utils/memutils.h"
3637
#include "access/heapam.h"
3738
#include "access/nbtree.h"
3839
#include "storage/ipc.h"
@@ -266,8 +267,6 @@ pathman_post_parse_analysis_hook(ParseState *pstate, Query *query)
266267
if (post_parse_analyze_hook_original)
267268
post_parse_analyze_hook_original(pstate, query);
268269

269-
// list_free(inheritance_disabled_relids);
270-
// list_free(inheritance_enabled_relids);
271270
inheritance_disabled_relids = NIL;
272271
inheritance_enabled_relids = NIL;
273272
}
@@ -308,7 +307,9 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
308307
result = standard_planner(parse, cursorOptions, boundParams);
309308

310309
list_free(inheritance_disabled_relids);
310+
list_free(inheritance_enabled_relids);
311311
inheritance_disabled_relids = NIL;
312+
inheritance_enabled_relids = NIL;
312313

313314
return result;
314315
}
@@ -320,9 +321,10 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
320321
static void
321322
disable_inheritance(Query *parse)
322323
{
323-
ListCell *lc;
324-
RangeTblEntry *rte;
325-
PartRelationInfo *prel;
324+
ListCell *lc;
325+
RangeTblEntry *rte;
326+
PartRelationInfo *prel;
327+
MemoryContext oldcontext;
326328
bool found;
327329

328330
/* If query contains CTE (WITH statement) then handle subqueries too */
@@ -351,8 +353,10 @@ disable_inheritance(Query *parse)
351353
* when user uses ONLY statement from case when we
352354
* make rte->inh false intentionally.
353355
*/
356+
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
354357
inheritance_enabled_relids = \
355358
lappend_oid(inheritance_enabled_relids, rte->relid);
359+
MemoryContextSwitchTo(oldcontext);
356360

357361
/*
358362
* Check if relation was already found with ONLY modifier. In
@@ -367,8 +371,10 @@ disable_inheritance(Query *parse)
367371
}
368372
}
369373

374+
oldcontext = MemoryContextSwitchTo(TopMemoryContext);
370375
inheritance_disabled_relids = \
371376
lappend_oid(inheritance_disabled_relids, rte->relid);
377+
MemoryContextSwitchTo(oldcontext);
372378

373379
/* Check if relation was already found withoud ONLY modifier */
374380
if (list_member_oid(inheritance_enabled_relids, rte->relid))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy