Skip to content

Commit 88437bd

Browse files
committed
Refresh update_copied_funcs.pl with newer patches
The contents of the custom patches applied by this script have become outdated as an effect of two things: - Automated indentation with ec1d8d6. - Hint state initialization, with 785023c. While the indentation had no problems, missing the initialization would lead immediately to a crash. update_copied_funcs.pl is updated so as applying the custom patches leads to no indent diffs, protecting the current code. Backpatch-through: 18
1 parent 7ba3532 commit 88437bd

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

update_copied_funcs.pl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,17 @@ sub make_join_rel_head
214214
else if (hint->value_type == RVT_ADD)
215215
result = rows + hint->rows;
216216
else if (hint->value_type == RVT_SUB)
217-
result = rows - hint->rows;
217+
result = rows - hint->rows;
218218
else if (hint->value_type == RVT_MULTI)
219219
result = rows * hint->rows;
220220
else
221-
Assert(false); /* unrecognized rows value type */
221+
Assert(false); /* unrecognized rows value type */
222222
223223
hint->base.state = HINT_STATE_USED;
224224
if (result < 1.0)
225225
ereport(WARNING,
226226
(errmsg("Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : %s",
227-
hint->base.hint_str)));
227+
hint->base.hint_str)));
228228
result = clamp_row_est(result);
229229
elog(DEBUG1, "adjusted rows %d to %d", (int) rows, (int) result);
230230
@@ -240,11 +240,11 @@ sub patch_make_join_rel
240240

241241
print $out <<"EOS";
242242
diff --git b/make_join_rel.c a/make_join_rel.c
243-
index 0e7b99f..287e7f1 100644
243+
index 6e601a6c86e6..23f06be4e6d4 100644
244244
--- b/make_join_rel.c
245245
+++ a/make_join_rel.c
246-
@@ -126,6 +126,84 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
247-
joinrel = build_join_rel(root, joinrelids, rel1, rel2, sjinfo,
246+
@@ -123,6 +123,85 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
247+
sjinfo, pushed_down_joins,
248248
&restrictlist);
249249
250250
+ /* !!! START: HERE IS THE PART WHICH IS ADDED FOR PG_HINT_PLAN !!! */
@@ -253,11 +253,12 @@ sub patch_make_join_rel
253253
+ int i;
254254
+ RowsHint *justforme = NULL;
255255
+ RowsHint *domultiply = NULL;
256+
+ RowsHint **rows_hints = (RowsHint **) get_current_hints(HINT_TYPE_ROWS);
256257
+
257258
+ /* Search for applicable rows hint for this join node */
258259
+ for (i = 0; i < current_hint_state->num_hints[HINT_TYPE_ROWS]; i++)
259260
+ {
260-
+ rows_hint = current_hint_state->rows_hints[i];
261+
+ rows_hint = rows_hints[i];
261262
+
262263
+ /*
263264
+ * Skip this rows_hint if it is invalid from the first or it
@@ -286,8 +287,8 @@ sub patch_make_join_rel
286287
+ * targets spread over both component rels. This menas that
287288
+ * this hint has been never applied so far and this joinrel is
288289
+ * the first (and only) chance to fire in current join tree.
289-
+ * Only the multiplication hint has the cumulative nature so we
290-
+ * apply only RVT_MULTI in this way.
290+
+ * Only the multiplication hint has the cumulative nature so
291+
+ * we apply only RVT_MULTI in this way.
291292
+ */
292293
+ domultiply = rows_hint;
293294
+ }

0 commit comments

Comments
 (0)