firtst release
Revision | 9c1e429852ccbe5c9785e51fd4db0765814b5333 (tree) |
---|---|
Time | 2020-07-14 17:10:36 |
Author | Daniil Anisimov <anisimow.d@gmai...> |
Commiter | Kyotaro Horiguchi |
Fix segfault when use Set, Rows and Parallel hints together
@@ -9085,3 +9085,34 @@ error hint: | ||
9085 | 9085 | ----+----- |
9086 | 9086 | (0 rows) |
9087 | 9087 | |
9088 | +-- all hint types together | |
9089 | +/*+ SeqScan(t1) MergeJoin(t1 t2) Leading(t1 t2) Rows(t1 t2 +10) Parallel(t1 8 hard) Set(random_page_cost 2.0)*/ | |
9090 | +EXPLAIN (costs off) SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id); | |
9091 | +DEBUG: adjusted rows 1000 to 1010 | |
9092 | +DEBUG: pg_hint_plan: | |
9093 | +used hint: | |
9094 | +SeqScan(t1) | |
9095 | +MergeJoin(t1 t2) | |
9096 | +Leading(t1 t2) | |
9097 | +Set(random_page_cost 2.0) | |
9098 | +Rows(t1 t2 +10) | |
9099 | +Parallel(t1 8 hard) | |
9100 | +not used hint: | |
9101 | +duplication hint: | |
9102 | +error hint: | |
9103 | + | |
9104 | + QUERY PLAN | |
9105 | +------------------------------------------------- | |
9106 | + Nested Loop | |
9107 | + -> Merge Join | |
9108 | + Merge Cond: (t2.id = t1.id) | |
9109 | + -> Index Scan using t2_pkey on t2 | |
9110 | + -> Sort | |
9111 | + Sort Key: t1.id | |
9112 | + -> Gather | |
9113 | + Workers Planned: 8 | |
9114 | + -> Parallel Seq Scan on t1 | |
9115 | + -> Index Scan using t3_pkey on t3 | |
9116 | + Index Cond: (id = t1.id) | |
9117 | +(11 rows) | |
9118 | + |
@@ -2079,7 +2079,7 @@ create_hintstate(Query *parse, const char *hints) | ||
2079 | 2079 | hstate->num_hints[HINT_TYPE_LEADING]); |
2080 | 2080 | hstate->rows_hints = (RowsHint **) (hstate->set_hints + |
2081 | 2081 | hstate->num_hints[HINT_TYPE_SET]); |
2082 | - hstate->parallel_hints = (ParallelHint **) (hstate->set_hints + | |
2082 | + hstate->parallel_hints = (ParallelHint **) (hstate->rows_hints + | |
2083 | 2083 | hstate->num_hints[HINT_TYPE_ROWS]); |
2084 | 2084 | |
2085 | 2085 | return hstate; |
@@ -1138,3 +1138,6 @@ set pg_hint_plan.parse_messages to 'NOTICE'; | ||
1138 | 1138 | /*+ SeqScan( */ SELECT 1; |
1139 | 1139 | /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0; |
1140 | 1140 | |
1141 | +-- all hint types together | |
1142 | +/*+ SeqScan(t1) MergeJoin(t1 t2) Leading(t1 t2) Rows(t1 t2 +10) Parallel(t1 8 hard) Set(random_page_cost 2.0)*/ | |
1143 | +EXPLAIN (costs off) SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id); |