From e457a3ffeb654fee6b0d276c219536d01b399b5e Mon Sep 17 00:00:00 2001 From: Mitsuru Hasegawa Date: Thu, 2 Aug 2012 17:34:21 +0900 Subject: [PATCH] =?utf8?q?=E3=83=8D=E3=82=B9=E3=83=88=E3=81=97=E3=81=9F?= =?utf8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=81=8C=E3=83=92=E3=83=B3?= =?utf8?q?=E3=83=88=E4=B8=AD=E3=81=AB=E6=8C=87=E5=AE=9A=E3=81=95=E3=82=8C?= =?utf8?q?=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AF=E3=80=81=E3=83=92=E3=83=B3?= =?utf8?q?=E3=83=88=E3=82=92=E7=84=A1=E5=8A=B9=E3=81=AB=E3=81=99=E3=82=8B?= =?utf8?q?=20=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=81=97?= =?utf8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- expected/pg_hint_plan.out | 33 +++++++++++++++++++++++++++++++++ pg_hint_plan.c | 3 +++ sql/pg_hint_plan.sql | 6 ++++++ 3 files changed, 42 insertions(+) diff --git a/expected/pg_hint_plan.out b/expected/pg_hint_plan.out index eebc634..2428270 100644 --- a/expected/pg_hint_plan.out +++ b/expected/pg_hint_plan.out @@ -64,6 +64,39 @@ EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; (4 rows) SET pg_hint_plan.enable TO on; +/*Set(enable_indexscan off)*/ +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; + QUERY PLAN +-------------------------------------- + Merge Join + Merge Cond: (t1.id = t2.id) + -> Index Scan using t1_pkey on t1 + -> Index Scan using t2_pkey on t2 +(4 rows) + +--+Set(enable_indexscan off) +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; + QUERY PLAN +-------------------------------------- + Merge Join + Merge Cond: (t1.id = t2.id) + -> Index Scan using t1_pkey on t1 + -> Index Scan using t2_pkey on t2 +(4 rows) + +/*+Set(enable_indexscan off) /* nest comment */ */ +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; +INFO: hint syntax error at or near "/* nest comment */ */ +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;" +DETAIL: Block comments nest doesn't supported. + QUERY PLAN +-------------------------------------- + Merge Join + Merge Cond: (t1.id = t2.id) + -> Index Scan using t1_pkey on t1 + -> Index Scan using t2_pkey on t2 +(4 rows) + /*+Set(enable_indexscan off)*/ EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; LOG: pg_hint_plan: diff --git a/pg_hint_plan.c b/pg_hint_plan.c index 0581031..4c7a664 100644 --- a/pg_hint_plan.c +++ b/pg_hint_plan.c @@ -1035,7 +1035,10 @@ parse_head_comment(Query *parse) /* 入れ子にしたブロックコメントはサポートしない */ if ((head = strstr(p, BLOCK_COMMENT_START)) != NULL && head < tail) + { parse_ereport(head, ("Block comments nest doesn't supported.")); + return NULL; + } /* ヒント句部分を切り出す */ len = tail - p; diff --git a/sql/pg_hint_plan.sql b/sql/pg_hint_plan.sql index a9a3206..d248e3c 100644 --- a/sql/pg_hint_plan.sql +++ b/sql/pg_hint_plan.sql @@ -17,6 +17,12 @@ SET pg_hint_plan.enable TO off; EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; SET pg_hint_plan.enable TO on; +/*Set(enable_indexscan off)*/ +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; +--+Set(enable_indexscan off) +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; +/*+Set(enable_indexscan off) /* nest comment */ */ +EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; /*+Set(enable_indexscan off)*/ EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id; /*+ Set(enable_indexscan off) Set(enable_hashjoin off) */ -- 2.11.0