8000 Bugfix. Copy of clauses, have got by aqo_get_clauses() has a specific… · postgrespro/aqo@9a1244f · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a1244f

Browse files
danolivoAlena Rybakina
authored and
Alena Rybakina
committed
Bugfix. Copy of clauses, have got by aqo_get_clauses() has a specific structure
and shouldn't be touched by any postgres machinery except node hash generator.
1 parent 878cd55 commit 9a1244f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

cardinality_hooks.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,17 @@ aqo_get_parameterized_baserel_size(PlannerInfo *root,
233233
{
234234
MemoryContext old_ctx_m;
235235

236+
selectivities = list_concat(
237+
get_selectivities(root, param_clauses, rel->relid,
238+
JOIN_INNER, NULL),
239+
get_selectivities(root, rel->baserestrictinfo,
240+
rel->relid,
241+
JOIN_INNER, NULL));
242+
243+
/* Make specific copy of clauses with mutated subplans */
236244
allclauses = list_concat(aqo_get_clauses(root, param_clauses),
237245
aqo_get_clauses(root, rel->baserestrictinfo));
238-
selectivities = get_selectivities(root, allclauses, rel->relid,
239-
JOIN_INNER, NULL);
246+
240247
rte = planner_rt_fetch(rel->relid, root);
241248
get_eclasses(allclauses, &nargs, &args_hash, &eclass_hash);
242249

path_utils.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,18 +443,16 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
443443
case T_ForeignPath:
444444
/* The same as in the default case */
445445
default:
446-
cur = list_concat(aqo_get_clauses(root,
447-
path->parent->baserestrictinfo),
446+
cur = list_concat(list_copy(path->parent->baserestrictinfo),
448447
path->param_info ?
449-
aqo_get_clauses(root,
450-
path->param_info->ppi_clauses) :
451-
NIL);
448+
path->param_info->ppi_clauses : NIL);
452449
if (path->param_info)
453450
cur_sel = get_selectivities(root, cur, path->parent->relid,
454451
JOIN_INNER, NULL);
455452
else
456453
cur_sel = get_selectivities(root, cur, 0, JOIN_INNER, NULL);
457454
*selectivities = cur_sel;
455+
cur = aqo_get_clauses(root, cur);
458456
return cur;
459457
break;
460458
}

0 commit comments

Comments
 (0)
0