firtst release
Revision | 96a53290f63b65449e48225db7256c1fee5ed79f (tree) |
---|---|
Time | 2020-07-14 17:30:56 |
Author | Daniil Anisimov <anisimow.d@gmai...> |
Commiter | Kyotaro Horiguchi |
Fix segfault when use Set, Rows and Parallel hints together
@@ -9135,3 +9135,34 @@ error hint: | ||
9135 | 9135 | ----+----- |
9136 | 9136 | (0 rows) |
9137 | 9137 | |
9138 | +-- all hint types together | |
9139 | +/*+ SeqScan(t1) MergeJoin(t1 t2) Leading(t1 t2) Rows(t1 t2 +10) Parallel(t1 8 hard) Set(random_page_cost 2.0)*/ | |
9140 | +EXPLAIN (costs off) SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id); | |
9141 | +DEBUG: adjusted rows 1000 to 1010 | |
9142 | +DEBUG: pg_hint_plan: | |
9143 | +used hint: | |
9144 | +SeqScan(t1) | |
9145 | +MergeJoin(t1 t2) | |
9146 | +Leading(t1 t2) | |
9147 | +Set(random_page_cost 2.0) | |
9148 | +Rows(t1 t2 +10) | |
9149 | +Parallel(t1 8 hard) | |
9150 | +not used hint: | |
9151 | +duplication hint: | |
9152 | +error hint: | |
9153 | + | |
9154 | + QUERY PLAN | |
9155 | +------------------------------------------------- | |
9156 | + Nested Loop | |
9157 | + -> Merge Join | |
9158 | + Merge Cond: (t2.id = t1.id) | |
9159 | + -> Index Scan using t2_pkey on t2 | |
9160 | + -> Sort | |
9161 | + Sort Key: t1.id | |
9162 | + -> Gather | |
9163 | + Workers Planned: 8 | |
9164 | + -> Parallel Seq Scan on t1 | |
9165 | + -> Index Scan using t3_pkey on t3 | |
9166 | + Index Cond: (id = t1.id) | |
9167 | +(11 rows) | |
9168 | + |
@@ -2083,7 +2083,7 @@ create_hintstate(Query *parse, const char *hints) | ||
2083 | 2083 | hstate->num_hints[HINT_TYPE_LEADING]); |
2084 | 2084 | hstate->rows_hints = (RowsHint **) (hstate->set_hints + |
2085 | 2085 | hstate->num_hints[HINT_TYPE_SET]); |
2086 | - hstate->parallel_hints = (ParallelHint **) (hstate->set_hints + | |
2086 | + hstate->parallel_hints = (ParallelHint **) (hstate->rows_hints + | |
2087 | 2087 | hstate->num_hints[HINT_TYPE_ROWS]); |
2088 | 2088 | |
2089 | 2089 | return hstate; |
@@ -1141,3 +1141,6 @@ set pg_hint_plan.parse_messages to 'NOTICE'; | ||
1141 | 1141 | /*+ SeqScan( */ SELECT 1; |
1142 | 1142 | /*+ SeqScan(t1) */ SELECT * FROM t1 LIMIT 0; |
1143 | 1143 | |
1144 | +-- all hint types together | |
1145 | +/*+ SeqScan(t1) MergeJoin(t1 t2) Leading(t1 t2) Rows(t1 t2 +10) Parallel(t1 8 hard) Set(random_page_cost 2.0)*/ | |
1146 | +EXPLAIN (costs off) SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id); |