firtst release
Révision | 628fa91f79b76b4f7351a5644f292f91d77eb7ce (tree) |
---|---|
l'heure | 2013-11-18 19:08:05 |
Auteur | Shigeru HANADA <shigeru.hanada@gmai...> |
Commiter | Shigeru HANADA |
Rowsヒントの絶対値指定にもプレフィックスを規定
絶対値の場合は「#10」のようにハッシュを前置する。
@@ -2058,7 +2058,12 @@ RowsHintParse(RowsHint *hint, HintState *hstate, Query *parse, | ||
2058 | 2058 | |
2059 | 2059 | /* Retieve rows estimation */ |
2060 | 2060 | rows_str = list_nth(name_list, hint->nrels); |
2061 | - if (rows_str[0] == '+') | |
2061 | + if (rows_str[0] == '#') | |
2062 | + { | |
2063 | + hint->value_type = RVT_ABSOLUTE; | |
2064 | + rows_str++; | |
2065 | + } | |
2066 | + else if (rows_str[0] == '+') | |
2062 | 2067 | { |
2063 | 2068 | hint->value_type = RVT_ADD; |
2064 | 2069 | rows_str++; |
@@ -2080,7 +2085,11 @@ RowsHintParse(RowsHint *hint, HintState *hstate, Query *parse, | ||
2080 | 2085 | } |
2081 | 2086 | else |
2082 | 2087 | { |
2083 | - hint->value_type = RVT_ABSOLUTE; | |
2088 | + hint_ereport(str, | |
2089 | + ("unrecognized rows value type notation.", | |
2090 | + hint->base.keyword)); | |
2091 | + hint->base.state = HINT_STATE_ERROR; | |
2092 | + return str; | |
2084 | 2093 | } |
2085 | 2094 | hint->rows = strtod(rows_str, &end_ptr); |
2086 | 2095 | if (*end_ptr) |
@@ -845,3 +845,10 @@ BEGIN | ||
845 | 845 | END; |
846 | 846 | $$; |
847 | 847 | DROP EXTENSION pg_hint_plan; |
848 | + | |
849 | +-- Rows hint tests | |
850 | +EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); | |
851 | +/*+ Rows(t1 t2 #10) */ | |
852 | +EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); | |
853 | +/*+ Rows(t1 t2 *10) */ | |
854 | +EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); |