OSDN Git Service

Fixed a bug related to SQL statements in PL/pgSQL functions.
[pghintplan/pg_hint_plan.git] / expected / ut-A.out
index deecafa..bde9049 100644 (file)
@@ -1,34 +1,22 @@
 LOAD 'pg_hint_plan';
-SET pg_hint_plan.enable TO on;
+SET pg_hint_plan.enable_hint TO on;
 SET pg_hint_plan.debug_print TO on;
 SET client_min_messages TO LOG;
 SET search_path TO public;
----- TODO 後で適切な位置に移動する
 ----
----- No. J-3-4 hint state output
+---- No.A-1-1 install
+---- No.A-2-1 uninstall
 ----
--- No. J-3-4-7
-/*+Set(enable_indexscan off)NestLoop("")Set(enable_bitmapscan off)*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near ")Set(enable_bitmapscan off)"
-DETAIL:  Relation name is necessary.
-LOG:  pg_hint_plan:
-used hint:
-Set(enable_indexscan off)
-not used hint:
-duplication hint:
-error hint:
-
-             QUERY PLAN             
-------------------------------------
- Bitmap Heap Scan on t1
-   Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
-         Index Cond: (c1 = 1)
-(4 rows)
-
+-- No.A-1-1-3
+CREATE EXTENSION pg_hint_plan;
+-- No.A-1-2-3
+DROP EXTENSION pg_hint_plan;
+-- No.A-1-1-4
+CREATE EXTENSION pg_hint_plan SCHEMA other_name;
+ERROR:  extension "pg_hint_plan" must be installed in schema "hint_plan"
+CREATE EXTENSION pg_hint_plan;
 ----
----- No. A-5-1 hint format
+---- No. A-5-1 comment pattern
 ----
 -- No. A-5-1-1
 /*+SeqScan(t1)*/
@@ -49,83 +37,129 @@ error hint:
 -- No. A-5-1-2
 /* +SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 -- No. A-5-1-3
---+SeqScan(t1)
+/*SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 -- No. A-5-1-4
 --+SeqScan(t1)
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 -- No. A-5-1-5
--- +SeqScan(t1)
+/* /*+SeqScan(t1)*/  */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-1-6
---SeqScan(t1)
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+----
+---- No. A-5-2 hint position
+----
+-- No. A-5-2-1
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+            QUERY PLAN             
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-1-7
-/*+SeqScan(t1) /* nest comment */ */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near "/* nest comment */ */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
-DETAIL:  Block comments nest doesn't supported.
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
-   Index Cond: (c1 = 1)
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-1-8
-/* +SeqScan(t1) /* nest comment */ */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+-- No. A-5-2-2
+EXPLAIN (COSTS false) SELECT c1, c2 AS c_2 /*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-5-2-3
+EXPLAIN (COSTS false) SELECT c1 AS "c1"/*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
+            QUERY PLAN             
+-----------------------------------
+ Index Only Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-1-9
-/*SeqScan(t1) /* nest comment */ */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+-- No. A-5-2-4
+EXPLAIN (COSTS false) SELECT * /*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 ----
----- No. A-5-2 hint position
+---- No. A-6-1 hint's table definition
 ----
--- No. A-5-2-1
-/*+SeqScan(t1)*/
+SET pg_hint_plan.enable_hint_table TO on;
+-- No. A-6-1-1
+\d hint_plan.hints
+                                  Table "hint_plan.hints"
+      Column       |  Type   |                          Modifiers                           
+-------------------+---------+--------------------------------------------------------------
+ id                | integer | not null default nextval('hint_plan.hints_id_seq'::regclass)
+ norm_query_string | text    | not null
+ application_name  | text    | not null
+ hints             | text    | not null
+Indexes:
+    "hints_pkey" PRIMARY KEY, btree (id)
+    "hints_norm_and_app" UNIQUE, btree (norm_query_string, application_name)
+
+----
+---- No. A-6-2 search condition
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-6-2-1
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
+       '',
+       'SeqScan(t1)');
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
 used hint:
@@ -140,41 +174,143 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-2-2
-/* normal comment */
-/*+SeqScan(t1)*/
+-- No. A-6-2-2
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
+       'psql',
+       'BitmapScan(t1)');
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+TRUNCATE hint_plan.hints;
+-- No. A-6-2-3
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
+       'dummy_application_name',
+       'SeqScan(t1)'
+);
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-2-3
-EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+TRUNCATE hint_plan.hints;
+-- No. A-6-2-4
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1;',
+       '',
+       'SeqScan(t1)'
+);
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
+TRUNCATE hint_plan.hints;
+----
+---- No. A-6-3 number of constant
+----
+-- No. A-6-3-1
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT c1 FROM s1.t1;',
+       '',
+       'SeqScan(t1)'
+);
+EXPLAIN (COSTS false) SELECT c1 FROM s1.t1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+   QUERY PLAN   
+----------------
+ Seq Scan on t1
+(1 row)
+
+TRUNCATE hint_plan.hints;
+-- No. A-6-3-2
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
+       '',
+       'SeqScan(t1)'
+);
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+TRUNCATE hint_plan.hints;
+-- No. A-6-3-3
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ? OR t1.c1 = ?;',
+       '',
+       'SeqScan(t1)'
+);
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 OR t1.c1 = 0;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Seq Scan on t1
+   Filter: ((c1 = 1) OR (c1 = 0))
+(2 rows)
+
+TRUNCATE hint_plan.hints;
+SET pg_hint_plan.enable_hint_table TO off;
 ----
----- No. A-5-4 hint delimiter
+---- No. A-7-2 hint delimiter
 ----
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-1
--- No. A-5-4-2
--- No. A-5-4-3
--- No. A-5-4-4
--- No. A-5-4-5
--- No. A-5-4-6
--- No. A-5-4-7
+-- No. A-7-2-1
+-- No. A-7-2-2
+-- No. A-7-2-3
+-- No. A-7-2-4
+-- No. A-7-2-5
+-- No. A-7-2-6
+-- No. A-7-2-7
 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -191,7 +327,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-8
+-- No. A-7-2-8
 /*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -208,7 +344,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-9
+-- No. A-7-2-9
 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -225,7 +361,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-10
+-- No. A-7-2-10
 /*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -242,7 +378,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-11
+-- No. A-7-2-11
 /*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -259,7 +395,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-12
+-- No. A-7-2-12
 /*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -276,7 +412,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-13
+-- No. A-7-2-13
 /*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -293,7 +429,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-14
+-- No. A-7-2-14
 /*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -310,7 +446,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-15
+-- No. A-7-2-15
 /*+    Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -327,7 +463,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-16
+-- No. A-7-2-16
 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -344,7 +480,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-17
+-- No. A-7-2-17
 /*+    Set     (enable_indexscan"off") Set     (enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -361,7 +497,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-18
+-- No. A-7-2-18
 /*+Set (       enable_indexscan"off")Set       (       enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -378,7 +514,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-19
+-- No. A-7-2-19
 /*+Set(enable_indexscan"off"   )       Set(enable_bitmapscan"off"      )       */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -395,7 +531,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-20
+-- No. A-7-2-20
 /*+Set(        enable_indexscan        "off"   )Set(   enable_bitmapscan       "off"   )*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -412,7 +548,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-21
+-- No. A-7-2-21
 /*+    Set     (       enable_indexscan        "off"   )       Set     (       enable_bitmapscan       "off"   )       */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -429,7 +565,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-22
+-- No. A-7-2-22
 /*+
 Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
@@ -447,7 +583,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-23
+-- No. A-7-2-23
 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
 */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
@@ -465,7 +601,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-24
+-- No. A-7-2-24
 /*+
 Set
 (enable_indexscan"off")
@@ -486,7 +622,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-25
+-- No. A-7-2-25
 /*+Set
 (
 enable_indexscan"off")Set
@@ -507,7 +643,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-26
+-- No. A-7-2-26
 /*+Set(enable_indexscan"off"
 )
 Set(enable_bitmapscan"off"
@@ -528,7 +664,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-27
+-- No. A-7-2-27
 /*+Set(
 enable_indexscan
 "off"
@@ -551,7 +687,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-28
+-- No. A-7-2-28
 /*+
 Set
 (
@@ -579,7 +715,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-29
+-- No. A-7-2-29
 /*+    
         Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
@@ -597,7 +733,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-30
+-- No. A-7-2-30
 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       
         */
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
@@ -615,7 +751,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-31
+-- No. A-7-2-31
 /*+    
         Set    
         (enable_indexscan"off")        
@@ -636,7 +772,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-32
+-- No. A-7-2-32
 /*+Set         
         (      
         enable_indexscan"off")Set      
@@ -657,7 +793,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-33
+-- No. A-7-2-33
 /*+Set(enable_indexscan"off"   
         )      
         Set(enable_bitmapscan"off"     
@@ -678,7 +814,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-34
+-- No. A-7-2-34
 /*+Set(        
         enable_indexscan       
         "off"  
@@ -701,7 +837,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-4-35
+-- No. A-7-2-35
 /*+    
         Set    
         (      
@@ -730,11 +866,11 @@ error hint:
 (2 rows)
 
 ----
----- No. A-5-5 hint object pattern
----- No. A-7-2 message object pattern
+---- No. A-7-3 hint object pattern
+---- No. A-9-2 message object pattern
 ----
--- No. A-5-5-1
--- No. A-7-2-1
+-- No. A-7-3-1
+-- No. A-9-2-1
 /*+SeqScan(t)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
 LOG:  pg_hint_plan:
@@ -795,8 +931,8 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-2
--- No. A-7-2-2
+-- No. A-7-3-2
+-- No. A-9-2-2
 /*+SeqScan(T)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
 LOG:  pg_hint_plan:
@@ -857,43 +993,23 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-3
--- No. A-7-2-3
+-- No. A-7-3-3
+-- No. A-9-2-3
 /*+SeqScan(()*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
-LOG:  pg_hint_plan:
-used hint:
-SeqScan(()
-not used hint:
-duplication hint:
-error hint:
-
-     QUERY PLAN     
---------------------
- Seq Scan on t1 "("
-   Filter: (c1 = 1)
-(2 rows)
-
-/*+SeqScan(((()*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
-LOG:  pg_hint_plan:
-used hint:
-SeqScan(((()
-not used hint:
-duplication hint:
-error hint:
-
-      QUERY PLAN      
-----------------------
- Seq Scan on t1 "((("
-   Filter: (c1 = 1)
+INFO:  pg_hint_plan: hint syntax error at or near "()"
+DETAIL:  Zero-length delimited string.
+            QUERY PLAN            
+----------------------------------
+ Index Scan using t1_i1 on t1 "("
+   Index Cond: (c1 = 1)
 (2 rows)
 
 /*+SeqScan("(")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
 LOG:  pg_hint_plan:
 used hint:
-SeqScan(()
+SeqScan("(")
 not used hint:
 duplication hint:
 error hint:
@@ -904,30 +1020,24 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
-/*+SeqScan("(((")*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+-- No. A-7-3-4
+-- No. A-9-2-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+INFO:  pg_hint_plan: hint syntax error at or near ")"
+DETAIL:  SeqScan hint requires a relation.
+INFO:  pg_hint_plan: hint syntax error at or near ")"
+DETAIL:  Unrecognized hint keyword ")".
 LOG:  pg_hint_plan:
 used hint:
-SeqScan(((()
 not used hint:
 duplication hint:
 error hint:
+SeqScan()
 
-      QUERY PLAN      
-----------------------
- Seq Scan on t1 "((("
-   Filter: (c1 = 1)
-(2 rows)
-
--- No. A-5-5-4
--- No. A-7-2-4
-/*+SeqScan())*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
-INFO:  hint syntax error at or near "))"
-DETAIL:  Relation name is necessary.
-             QUERY PLAN             
-------------------------------------
- Index Scan using t1_pkey on t1 ")"
+            QUERY PLAN            
+----------------------------------
+ Index Scan using t1_i1 on t1 ")"
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -961,15 +1071,15 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-5
--- No. A-7-2-5
+-- No. A-7-3-5
+-- No. A-9-2-5
 /*+SeqScan(")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Unterminated quoted relation name.
-             QUERY PLAN              
--------------------------------------
- Index Scan using t1_pkey on t1 """"
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Unterminated quoted string.
+            QUERY PLAN             
+-----------------------------------
+ Index Scan using t1_i1 on t1 """"
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -1003,15 +1113,22 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-6
--- No. A-7-2-6
+-- No. A-7-3-6
+-- No. A-9-2-6
 /*+SeqScan( )*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
-INFO:  hint syntax error at or near ")"
-DETAIL:  Relation name is necessary.
-             QUERY PLAN             
-------------------------------------
- Index Scan using t1_pkey on t1 " "
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  SeqScan hint requires a relation.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+SeqScan()
+
+            QUERY PLAN            
+----------------------------------
+ Index Scan using t1_i1 on t1 " "
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -1045,15 +1162,22 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-7
--- No. A-7-2-7
+-- No. A-7-3-7
+-- No. A-9-2-7
 /*+SeqScan(    )*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "    " WHERE "       ".c1 = 1;
-INFO:  hint syntax error at or near ")"
-DETAIL:  Relation name is necessary.
-                QUERY PLAN                 
--------------------------------------------
- Index Scan using t1_pkey on t1 "        "
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  SeqScan hint requires a relation.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+SeqScan()
+
+            QUERY PLAN             
+-----------------------------------
+ Index Scan using t1_i1 on t1 "  "
    Index Cond: (c1 = 1)
 (2 rows)
 
@@ -1087,18 +1211,25 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-8
--- No. A-7-2-8
+-- No. A-7-3-8
+-- No. A-9-2-8
 /*+SeqScan(
 )*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
 " WHERE "
 ".c1 = 1;
-INFO:  hint syntax error at or near ")"
-DETAIL:  Relation name is necessary.
-            QUERY PLAN            
-----------------------------------
- Index Scan using t1_pkey on t1 "
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  SeqScan hint requires a relation.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+SeqScan()
+
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_i1 on t1 "
  "
    Index Cond: (c1 = 1)
 (3 rows)
@@ -1153,8 +1284,8 @@ error hint:
    Filter: (c1 = 1)
 (5 rows)
 
--- No. A-5-5-9
--- No. A-7-2-9
+-- No. A-7-3-9
+-- No. A-9-2-9
 /*+SeqScan(Set)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
 LOG:  pg_hint_plan:
@@ -1200,8 +1331,8 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-10
--- No. A-7-2-10
+-- No. A-7-3-10
+-- No. A-9-2-10
 /*+SeqScan(あ)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
 LOG:  pg_hint_plan:
@@ -1262,45 +1393,45 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-11
--- No. A-7-2-11
+-- No. A-7-3-11
+-- No. A-9-2-11
 /*+SeqScan(/**/)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
-INFO:  hint syntax error at or near "/**/)*/
+INFO:  pg_hint_plan: hint syntax error at or near "/**/)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;"
-DETAIL:  Block comments nest doesn't supported.
-              QUERY PLAN               
----------------------------------------
- Index Scan using t1_pkey on t1 "/**/"
+DETAIL:  Nested block comments are not supported.
+             QUERY PLAN              
+-------------------------------------
+ Index Scan using t1_i1 on t1 "/**/"
    Index Cond: (c1 = 1)
 (2 rows)
 
 /*+SeqScan(/**//**//**/)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
-INFO:  hint syntax error at or near "/**//**//**/)*/
+INFO:  pg_hint_plan: hint syntax error at or near "/**//**//**/)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;"
-DETAIL:  Block comments nest doesn't supported.
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using t1_pkey on t1 "/**//**//**/"
+DETAIL:  Nested block comments are not supported.
+                 QUERY PLAN                  
+---------------------------------------------
+ Index Scan using t1_i1 on t1 "/**//**//**/"
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-5-5-12
--- No. A-7-2-12
+-- No. A-7-3-12
+-- No. A-9-2-12
 /*+SeqScan("tT()""     
 Set/**/あ")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
 Set/**/あ" WHERE "tT()""      
 Set/**/あ".c1 = 1;
-INFO:  hint syntax error at or near "/**/あ")*/
+INFO:  pg_hint_plan: hint syntax error at or near "/**/あ")*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
 Set/**/あ" WHERE "tT()""      
 Set/**/あ".c1 = 1;"
-DETAIL:  Block comments nest doesn't supported.
+DETAIL:  Nested block comments are not supported.
                 QUERY PLAN                
 ------------------------------------------
- Index Scan using t1_pkey on t1 "tT()""  
+ Index Scan using t1_i1 on t1 "tT()""    
  Set/**/あ"
    Index Cond: (c1 = 1)
 (3 rows)
@@ -1326,14 +1457,31 @@ error hint:
    Filter: (c1 = 1)
 (3 rows)
 
+-- No. A-7-3-13
+-- No. A-9-2-13
+/*+SeqScan(a123456789b123456789c123456789d123456789e123456789f123)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "123456789012345678901234567890123456789012345678901234" WHERE "123456789012345678901234567890123456789012345678901234".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(a123456789b123456789c123456789d123456789e123456789f123)
+duplication hint:
+error hint:
+
+                                      QUERY PLAN                                       
+---------------------------------------------------------------------------------------
+ Index Scan using t1_i1 on t1 "123456789012345678901234567890123456789012345678901234"
+   Index Cond: (c1 = 1)
+(2 rows)
+
 ----
----- No. A-5-6 hint parse error
+---- No. A-7-4 hint parse error
 ----
--- No. A-5-6-1
+-- No. A-7-4-1
 /*+Set(enable_indexscan off)Set enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near "enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
-DETAIL:  Opened parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near "enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL:  Opening parenthesis is necessary.
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1341,19 +1489,19 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-2
+-- No. A-7-4-2
 /*+Set(enable_indexscan off)Set(enable_tidscan off Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near "Set(enable_bitmapscan off)SeqScan(t1)"
-DETAIL:  Closed parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near "(enable_bitmapscan off)SeqScan(t1)"
+DETAIL:  Zero-length delimited string.
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1361,19 +1509,19 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-3
+-- No. A-7-4-3
 /*+Set(enable_indexscan off)Set(enable_tidscan "off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Unterminated quoted parameter value.
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Unterminated quoted string.
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1381,19 +1529,19 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-4
+-- No. A-7-4-4
 /*+Set(enable_indexscan off)SeqScan("")Set(enable_bitmapscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near ")Set(enable_bitmapscan off)"
-DETAIL:  Relation name is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near ")Set(enable_bitmapscan off)"
+DETAIL:  Zero-length delimited string.
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1401,19 +1549,19 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-5
+-- No. A-7-4-5
 /*+Set(enable_indexscan off)NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near "NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
-DETAIL:  Keyword "NoSet" does not exist.
+INFO:  pg_hint_plan: hint syntax error at or near "NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL:  Unrecognized hint keyword "NoSet".
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1421,19 +1569,19 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-6
+-- No. A-7-4-6
 /*+Set(enable_indexscan off)"Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near ""Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
-DETAIL:  Keyword ""Set"" does not exist.
+INFO:  pg_hint_plan: hint syntax error at or near ""Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
+DETAIL:  Unrecognized hint keyword ""Set"".
 LOG:  pg_hint_plan:
 used hint:
 Set(enable_indexscan off)
@@ -1441,35 +1589,35 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-5-6-7
+-- No. A-7-4-7
 /*+Set(enable_indexscan off)Set(enable_tidscan /* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-INFO:  hint syntax error at or near "/* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
+INFO:  pg_hint_plan: hint syntax error at or near "/* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
-DETAIL:  Block comments nest doesn't supported.
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+DETAIL:  Nested block comments are not supported.
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 ----
----- No. A-6-1 original GUC parameter
+---- No. A-8-1 original GUC parameter
 ----
--- No. A-6-1-1
+-- No. A-8-1-1
 SET ROLE super_user;
 SET pg_hint_plan.debug_print TO off;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
@@ -1485,12 +1633,12 @@ SHOW pg_hint_plan.parse_messages;
  info
 (1 row)
 
-SET pg_hint_plan.enable TO off;
+SET pg_hint_plan.enable_hint TO off;
 SET pg_hint_plan.debug_print TO on;
 SET pg_hint_plan.parse_messages TO error;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  off
 (1 row)
 
@@ -1506,12 +1654,12 @@ SHOW pg_hint_plan.parse_messages;
  error
 (1 row)
 
-RESET pg_hint_plan.enable;
+RESET pg_hint_plan.enable_hint;
 RESET pg_hint_plan.debug_print;
 RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
@@ -1527,11 +1675,11 @@ SHOW pg_hint_plan.parse_messages;
  info
 (1 row)
 
--- No. A-6-1-2
+-- No. A-8-1-2
 SET ROLE normal_user;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
@@ -1547,12 +1695,12 @@ SHOW pg_hint_plan.parse_messages;
  info
 (1 row)
 
-SET pg_hint_plan.enable TO off;
+SET pg_hint_plan.enable_hint TO off;
 SET pg_hint_plan.debug_print TO on;
 SET pg_hint_plan.parse_messages TO error;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  off
 (1 row)
 
@@ -1568,12 +1716,12 @@ SHOW pg_hint_plan.parse_messages;
  error
 (1 row)
 
-RESET pg_hint_plan.enable;
+RESET pg_hint_plan.enable_hint;
 RESET pg_hint_plan.debug_print;
 RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
@@ -1591,73 +1739,73 @@ SHOW pg_hint_plan.parse_messages;
 
 RESET ROLE;
 ----
----- No. A-6-2 original GUC parameter pg_hint_plan.enable
+---- No. A-8-2 original GUC parameter pg_hint_plan.enable_hint
 ----
--- No. A-6-2-1
-SET pg_hint_plan.enable TO on;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+-- No. A-8-2-1
+SET pg_hint_plan.enable_hint TO on;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
 /*+Set(enable_indexscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-6-2-2
-SET pg_hint_plan.enable TO off;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+-- No. A-8-2-2
+SET pg_hint_plan.enable_hint TO off;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  off
 (1 row)
 
 /*+Set(enable_indexscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-6-2-3
-SET pg_hint_plan.enable TO DEFAULT;
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+-- No. A-8-2-3
+SET pg_hint_plan.enable_hint TO DEFAULT;
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
 /*+Set(enable_indexscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-6-2-4
-SET pg_hint_plan.enable TO enable;
-ERROR:  parameter "pg_hint_plan.enable" requires a Boolean value
-SHOW pg_hint_plan.enable;
- pg_hint_plan.enable 
----------------------
+-- No. A-8-2-4
+SET pg_hint_plan.enable_hint TO enable;
+ERROR:  parameter "pg_hint_plan.enable_hint" requires a Boolean value
+SHOW pg_hint_plan.enable_hint;
+ pg_hint_plan.enable_hint 
+--------------------------
  on
 (1 row)
 
 ----
----- No. A-6-3 original GUC parameter pg_hint_plan.debug_print
+---- No. A-8-3 original GUC parameter pg_hint_plan.debug_print
 ----
--- No. A-6-3-1
+-- No. A-8-3-1
 SET pg_hint_plan.debug_print TO on;
 SHOW pg_hint_plan.debug_print;
  pg_hint_plan.debug_print 
@@ -1674,15 +1822,15 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-6-3-2
+-- No. A-8-3-2
 SET pg_hint_plan.debug_print TO off;
 SHOW pg_hint_plan.debug_print;
  pg_hint_plan.debug_print 
@@ -1692,15 +1840,15 @@ SHOW pg_hint_plan.debug_print;
 
 /*+Set(enable_indexscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-6-3-3
+-- No. A-8-3-3
 SET pg_hint_plan.debug_print TO DEFAULT;
 SHOW pg_hint_plan.debug_print;
  pg_hint_plan.debug_print 
@@ -1710,17 +1858,18 @@ SHOW pg_hint_plan.debug_print;
 
 /*+Set(enable_indexscan off)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (4 rows)
 
--- No. A-6-3-4
+-- No. A-8-3-4
 SET pg_hint_plan.debug_print TO enable;
-ERROR:  parameter "pg_hint_plan.debug_print" requires a Boolean value
+ERROR:  invalid value for parameter "pg_hint_plan.debug_print": "enable"
+HINT:  Available values: off, on, detailed, verbose.
 SHOW pg_hint_plan.debug_print;
  pg_hint_plan.debug_print 
 --------------------------
@@ -1728,13 +1877,13 @@ SHOW pg_hint_plan.debug_print;
 (1 row)
 
 ----
----- No. A-6-4 original GUC parameter pg_hint_plan.parse_messages
+---- No. A-8-4 original GUC parameter pg_hint_plan.parse_messages
 ----
 SET client_min_messages TO debug5;
 DEBUG:  CommitTransactionCommand
 DEBUG:  CommitTransaction
 DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
--- No. A-6-4-1
+-- No. A-8-4-1
 SET pg_hint_plan.parse_messages TO debug5;
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
@@ -1760,8 +1909,8 @@ DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid:
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
 DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
-DEBUG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+DEBUG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
 DEBUG:  CommitTransactionCommand
 DEBUG:  CommitTransaction
 DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
@@ -1790,7 +1939,7 @@ DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid:
         1
 (1 row)
 
--- No. A-6-4-2
+-- No. A-8-4-2
 SET pg_hint_plan.parse_messages TO debug4;
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
@@ -1816,8 +1965,8 @@ DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid:
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
 DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
-DEBUG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+DEBUG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
 DEBUG:  CommitTransactionCommand
 DEBUG:  CommitTransaction
 DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
@@ -1846,7 +1995,7 @@ DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid:
         1
 (1 row)
 
--- No. A-6-4-3
+-- No. A-8-4-3
 SET pg_hint_plan.parse_messages TO debug3;
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
@@ -1872,8 +2021,8 @@ DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid:
 DEBUG:  StartTransactionCommand
 DEBUG:  StartTransaction
 DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
-DEBUG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+DEBUG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
 DEBUG:  CommitTransactionCommand
 DEBUG:  CommitTransaction
 DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children: 
@@ -1893,7 +2042,7 @@ DEBUG:  ProcessUtility
         1
 (1 row)
 
--- No. A-6-4-4
+-- No. A-8-4-4
 SET pg_hint_plan.parse_messages TO debug2;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -1902,8 +2051,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-DEBUG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+DEBUG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -1916,7 +2065,7 @@ SET client_min_messages TO debug1;
         1
 (1 row)
 
--- No. A-6-4-5
+-- No. A-8-4-5
 SET pg_hint_plan.parse_messages TO debug1;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -1925,8 +2074,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-DEBUG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+DEBUG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -1939,7 +2088,7 @@ SET client_min_messages TO log;
         1
 (1 row)
 
--- No. A-6-4-6
+-- No. A-8-4-6
 SET pg_hint_plan.parse_messages TO log;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -1948,8 +2097,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-LOG:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+LOG:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -1962,7 +2111,7 @@ SET client_min_messages TO info;
         1
 (1 row)
 
--- No. A-6-4-7
+-- No. A-8-4-7
 SET pg_hint_plan.parse_messages TO info;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -1971,8 +2120,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -1980,14 +2129,14 @@ DETAIL:  Opened parenthesis is necessary.
 
 SET client_min_messages TO notice;
 /*+Set*/SELECT 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
 (1 row)
 
--- No. A-6-4-8
+-- No. A-8-4-8
 SET pg_hint_plan.parse_messages TO notice;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -1996,8 +2145,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-NOTICE:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+NOTICE:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -2010,7 +2159,7 @@ SET client_min_messages TO warning;
         1
 (1 row)
 
--- No. A-6-4-9
+-- No. A-8-4-9
 SET pg_hint_plan.parse_messages TO warning;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -2019,8 +2168,8 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-WARNING:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+WARNING:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
@@ -2033,7 +2182,7 @@ SET client_min_messages TO error;
         1
 (1 row)
 
--- No. A-6-4-10
+-- No. A-8-4-10
 SET pg_hint_plan.parse_messages TO error;
 SHOW pg_hint_plan.parse_messages;
  pg_hint_plan.parse_messages 
@@ -2042,11 +2191,11 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-ERROR:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+ERROR:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
 SET client_min_messages TO fatal;
 /*+Set*/SELECT 1;
--- No. A-6-4-11
+-- No. A-8-4-11
 RESET client_min_messages;
 SET pg_hint_plan.parse_messages TO DEFAULT;
 SHOW pg_hint_plan.parse_messages;
@@ -2056,14 +2205,14 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 /*+Set*/SELECT 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Opened parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Opening parenthesis is necessary.
  ?column? 
 ----------
         1
 (1 row)
 
--- No. A-6-4-12
+-- No. A-8-4-12
 SET pg_hint_plan.parse_messages TO fatal;
 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "fatal"
 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
@@ -2073,7 +2222,7 @@ SHOW pg_hint_plan.parse_messages;
  info
 (1 row)
 
--- No. A-6-4-13
+-- No. A-8-4-13
 SET pg_hint_plan.parse_messages TO panic;
 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "panic"
 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
@@ -2083,7 +2232,7 @@ SHOW pg_hint_plan.parse_messages;
  info
 (1 row)
 
--- No. A-6-4-14
+-- No. A-8-4-14
 SET pg_hint_plan.parse_messages TO on;
 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "on"
 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
@@ -2094,39 +2243,104 @@ SHOW pg_hint_plan.parse_messages;
 (1 row)
 
 ----
----- No. A-7-1 parse error message output
+---- No. A-8-5 original GUC parameter pg_hint_plan.enable_hint_table
+----
+INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
+       VALUES (
+       'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
+       '',
+       'SeqScan(t1)');
+-- No. A-8-5-1
+SET pg_hint_plan.enable_hint_table TO on;
+SHOW pg_hint_plan.enable_hint_table;
+ pg_hint_plan.enable_hint_table 
+--------------------------------
+ on
+(1 row)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. A-8-5-2
+SET pg_hint_plan.enable_hint_table TO off;
+SHOW pg_hint_plan.enable_hint_table;
+ pg_hint_plan.enable_hint_table 
+--------------------------------
+ off
+(1 row)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-8-5-3
+SET pg_hint_plan.enable_hint_table TO DEFAULT;
+SHOW pg_hint_plan.enable_hint_table;
+ pg_hint_plan.enable_hint_table 
+--------------------------------
+ off
+(1 row)
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. A-8-5-4
+SET pg_hint_plan.enable_hint_table TO enable;
+ERROR:  parameter "pg_hint_plan.enable_hint_table" requires a Boolean value
+SHOW pg_hint_plan.enable_hint_table;
+ pg_hint_plan.enable_hint_table 
+--------------------------------
+ off
+(1 row)
+
+TRUNCATE hint_plan.hints;
+----
+---- No. A-9-1 parse error message output
 ----
--- No. A-7-1-1
+-- No. A-9-1-1
 /*+"Set"(enable_indexscan on)*/SELECT 1;
-INFO:  hint syntax error at or near ""Set"(enable_indexscan on)"
-DETAIL:  Keyword ""Set"" does not exist.
+INFO:  pg_hint_plan: hint syntax error at or near ""Set"(enable_indexscan on)"
+DETAIL:  Unrecognized hint keyword ""Set"".
  ?column? 
 ----------
         1
 (1 row)
 
 /*+Set()(enable_indexscan on)*/SELECT 1;
-INFO:  hint syntax error at or near ")(enable_indexscan on)"
-DETAIL:  Parameter name is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near "Set()(enable_indexscan on)"
+DETAIL:  Set hint requires name and value of GUC parameter.
+INFO:  pg_hint_plan: hint syntax error at or near "(enable_indexscan on)"
+DETAIL:  Unrecognized hint keyword "".
  ?column? 
 ----------
         1
 (1 row)
 
 /*+Set(enable_indexscan on*/SELECT 1;
-INFO:  hint syntax error at or near ""
-DETAIL:  Closed parenthesis is necessary.
+INFO:  pg_hint_plan: hint syntax error at or near ""
+DETAIL:  Closing parenthesis is necessary.
  ?column? 
 ----------
         1
 (1 row)
 
 ----
----- No. A-7-3 hint state output
+---- No. A-9-3 hint state output
 ----
 SET pg_hint_plan.debug_print TO on;
 SET client_min_messages TO LOG;
--- No. A-7-3-1
+-- No. A-9-3-1
 /*+SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -2142,7 +2356,7 @@ error hint:
    Filter: (c1 = 1)
 (2 rows)
 
--- No. A-7-3-2
+-- No. A-9-3-2
 /*+SeqScan(no_table)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 LOG:  pg_hint_plan:
@@ -2152,13 +2366,13 @@ SeqScan(no_table)
 duplication hint:
 error hint:
 
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
--- No. A-7-3-3
+-- No. A-9-3-3
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
             QUERY PLAN             
 -----------------------------------
@@ -2169,7 +2383,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
 
 /*+TidScan(t1)BitmapScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
-INFO:  hint syntax error at or near "TidScan(t1)BitmapScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)"
 DETAIL:  Conflict scan method hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -2179,20 +2393,20 @@ duplication hint:
 TidScan(t1)
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 = 1)
 (5 rows)
 
 /*+TidScan(t1)BitmapScan(t1)IndexScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
-INFO:  hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)"
 DETAIL:  Conflict scan method hint.
-INFO:  hint syntax error at or near "BitmapScan(t1)IndexScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)"
 DETAIL:  Conflict scan method hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -2205,18 +2419,18 @@ error hint:
 
            QUERY PLAN            
 ---------------------------------
- Index Scan using t1_pkey on t1
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
    Filter: (ctid = '(1,1)'::tid)
 (3 rows)
 
 /*+TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
-INFO:  hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
 DETAIL:  Conflict scan method hint.
-INFO:  hint syntax error at or near "BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
 DETAIL:  Conflict scan method hint.
-INFO:  hint syntax error at or near "IndexScan(t1)SeqScan(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "IndexScan(t1)SeqScan(t1)"
 DETAIL:  Conflict scan method hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -2234,7 +2448,7 @@ error hint:
    Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
 (2 rows)
 
--- No. A-7-3-4
+-- No. A-9-3-4
 /*+Set(enable_indexscan enable)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 INFO:  parameter "enable_indexscan" requires a Boolean value
@@ -2245,26 +2459,61 @@ duplication hint:
 error hint:
 Set(enable_indexscan enable)
 
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 ----
----- No. A-8-1 hint state output
+---- No. A-10-1 hint state output
 ----
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 EXPLAIN (COSTS false) EXECUTE p1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 DEALLOCATE p1;
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
-EXPLAIN (COSTS false) EXECUTE p1 (1);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
      QUERY PLAN      
 ---------------------
  Seq Scan on t1
@@ -2272,10 +2521,12 @@ EXPLAIN (COSTS false) EXECUTE p1 (1);
 (2 rows)
 
 DEALLOCATE p1;
--- No. A-8-1-1
--- No. A-8-1-2
+-- No. A-10-1-1
+-- No. A-10-1-2
 /*+SeqScan(t1)*/
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1;
 LOG:  pg_hint_plan:
 used hint:
 SeqScan(t1)
@@ -2283,8 +2534,6 @@ not used hint:
 duplication hint:
 error hint:
 
-/*+BitmapScan(t1)*/
-EXPLAIN (COSTS false) EXECUTE p1;
      QUERY PLAN     
 --------------------
  Seq Scan on t1
@@ -2310,6 +2559,8 @@ error hint:
 DEALLOCATE p1;
 /*+BitmapScan(t1)*/
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
 BitmapScan(t1)
@@ -2317,19 +2568,33 @@ not used hint:
 duplication hint:
 error hint:
 
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
 /*+SeqScan(t1)*/
-EXPLAIN (COSTS false) EXECUTE p1 (1);
-             QUERY PLAN             
-------------------------------------
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
-   Recheck Cond: (c1 < $1)
-   ->  Bitmap Index Scan on t1_pkey
-         Index Cond: (c1 < $1)
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
 (4 rows)
 
-UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
 /*+SeqScan(t1)*/
-EXPLAIN (COSTS false) EXECUTE p1 (1);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
 BitmapScan(t1)
@@ -2337,51 +2602,50 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
-   Recheck Cond: (c1 < $1)
-   ->  Bitmap Index Scan on t1_pkey
-         Index Cond: (c1 < $1)
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
 (4 rows)
 
-DEALLOCATE p1;
--- No. A-8-1-3
--- No. A-8-1-4
 /*+SeqScan(t1)*/
-PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
-SeqScan(t1)
+BitmapScan(t1)
 not used hint:
 duplication hint:
 error hint:
 
-EXPLAIN (COSTS false) EXECUTE p1;
-     QUERY PLAN     
---------------------
- Seq Scan on t1
-   Filter: (c1 = 1)
-(2 rows)
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
 
-UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
-EXPLAIN (COSTS false) EXECUTE p1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
-SeqScan(t1)
+BitmapScan(t1)
 not used hint:
 duplication hint:
 error hint:
 
-     QUERY PLAN     
---------------------
- Seq Scan on t1
-   Filter: (c1 = 1)
-(2 rows)
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
 
-DEALLOCATE p1;
-/*+BitmapScan(t1)*/
-PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
 BitmapScan(t1)
@@ -2389,17 +2653,17 @@ not used hint:
 duplication hint:
 error hint:
 
-EXPLAIN (COSTS false) EXECUTE p1 (1);
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 < $1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 < $1)
 (4 rows)
 
 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
-EXPLAIN (COSTS false) EXECUTE p1 (1);
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
 BitmapScan(t1)
@@ -2407,39 +2671,224 @@ not used hint:
 duplication hint:
 error hint:
 
-             QUERY PLAN             
-------------------------------------
+            QUERY PLAN            
+----------------------------------
  Bitmap Heap Scan on t1
    Recheck Cond: (c1 < $1)
-   ->  Bitmap Index Scan on t1_pkey
+   ->  Bitmap Index Scan on t1_i1
          Index Cond: (c1 < $1)
 (4 rows)
 
 DEALLOCATE p1;
--- No. A-8-1-5
--- No. A-8-1-6
+-- No. A-10-1-3
+-- No. A-10-1-4
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-10-1-5
+-- No. A-10-1-6
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 /*+BitmapScan(t1)*/
 EXPLAIN (COSTS false) EXECUTE p1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
 /*+BitmapScan(t1)*/
 EXPLAIN (COSTS false) EXECUTE p1;
-           QUERY PLAN           
---------------------------------
- Index Scan using t1_pkey on t1
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
    Index Cond: (c1 = 1)
 (2 rows)
 
 DEALLOCATE p1;
 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
 /*+BitmapScan(t1)*/
-EXPLAIN (COSTS false) EXECUTE p1 (1);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
      QUERY PLAN      
 ---------------------
  Seq Scan on t1
@@ -2448,7 +2897,7 @@ EXPLAIN (COSTS false) EXECUTE p1 (1);
 
 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
 /*+BitmapScan(t1)*/
-EXPLAIN (COSTS false) EXECUTE p1 (1);
+EXPLAIN (COSTS false) EXECUTE p1 (1000);
      QUERY PLAN      
 ---------------------
  Seq Scan on t1
@@ -2456,49 +2905,28 @@ EXPLAIN (COSTS false) EXECUTE p1 (1);
 (2 rows)
 
 DEALLOCATE p1;
-----
----- No. A-8-4 EXECUTE statement name error
-----
--- No. A-8-4-1
-EXECUTE p1;
-ERROR:  prepared statement "p1" does not exist
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- on
-(1 row)
-
-----
----- No. A-9-5 EXECUTE statement name error
-----
--- No. A-9-5-1
-CREATE EXTENSION pg_stat_statements;
-SELECT pg_stat_statements_reset();
- pg_stat_statements_reset 
---------------------------
-(1 row)
-
-SELECT * FROM s1.t1 WHERE t1.c1 = 1;
- c1 | c2 | c3 | c4 
-----+----+----+----
-  1 |  1 |  1 | 1
-(1 row)
-
-/*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+-- No. A-10-1-9
+-- No. A-10-1-10
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
 LOG:  pg_hint_plan:
 used hint:
-Set(enable_seqscan off)
+SeqScan(t1)
 not used hint:
 duplication hint:
 error hint:
 
- c1 | c2 | c3 | c4 
-----+----+----+----
-  1 |  1 |  1 | 1
-(1 row)
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
 
-/*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
 LOG:  pg_hint_plan:
 used hint:
 SeqScan(t1)
@@ -2506,68 +2934,475 @@ not used hint:
 duplication hint:
 error hint:
 
- c1 | c2 | c3 | c4 
-----+----+----+----
-  1 |  1 |  1 | 1
-(1 row)
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
 
-SELECT s.query, s.calls
-  FROM public.pg_stat_statements s
-  JOIN pg_catalog.pg_database d
-    ON (s.dbid = d.oid)
- ORDER BY 1;
-                               query                               | calls 
--------------------------------------------------------------------+-------
- /*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;             |     1
- /*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1; |     1
- SELECT * FROM s1.t1 WHERE t1.c1 = 1;                              |     1
- SELECT pg_stat_statements_reset();                                |     1
-(4 rows)
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
 
-----
----- No. A-12-1 reset of global variable of core at the error
----- No. A-12-2 reset of global variable of original at the error
-----
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
-              QUERY PLAN              
---------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(6 rows)
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
 
-/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
-PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
-INFO:  hint syntax error at or near "NestLoop(t1 t1)"
-DETAIL:  Relation name "t1" is duplicate.
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
 LOG:  pg_hint_plan:
 used hint:
-SeqScan(t1)
-MergeJoin(t1 t2)
-Set(enable_seqscan off)
-Set(geqo_threshold 100)
+BitmapScan(t1)
 not used hint:
 duplication hint:
 error hint:
-NestLoop(t1 t1)
 
-EXPLAIN (COSTS false) EXECUTE p1;
-              QUERY PLAN              
---------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Sort
-         Sort Key: t1.c1
-         ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
-(6 rows)
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
 
--- No. A-12-1-1
--- No. A-12-2-1
-SELECT name, setting FROM settings;
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-10-1-11
+-- No. A-10-1-12
+/*+SeqScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+/*+BitmapScan(t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < 1000)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < 1000)
+(4 rows)
+
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+LOG:  pg_hint_plan:
+used hint:
+BitmapScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+            QUERY PLAN            
+----------------------------------
+ Bitmap Heap Scan on t1
+   Recheck Cond: (c1 < $1)
+   ->  Bitmap Index Scan on t1_i1
+         Index Cond: (c1 < $1)
+(4 rows)
+
+DEALLOCATE p1;
+-- No. A-10-1-13
+-- No. A-10-1-14
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
+          QUERY PLAN          
+------------------------------
+ Index Scan using t1_i1 on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+DEALLOCATE p1;
+PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+      QUERY PLAN       
+-----------------------
+ Seq Scan on t1
+   Filter: (c1 < 1000)
+(2 rows)
+
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+     QUERY PLAN      
+---------------------
+ Seq Scan on t1
+   Filter: (c1 < $1)
+(2 rows)
+
+UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
+/*+BitmapScan(t1)*/
+EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
+     QUERY PLAN      
+---------------------
+ Seq Scan on t1
+   Filter: (c1 < $1)
+(2 rows)
+
+DEALLOCATE p1;
+----
+---- No. A-10-4 EXECUTE statement name error
+----
+-- No. A-10-4-1
+EXECUTE p1;
+ERROR:  prepared statement "p1" does not exist
+SHOW pg_hint_plan.debug_print;
+ pg_hint_plan.debug_print 
+--------------------------
+ on
+(1 row)
+
+----
+---- No. A-11-5 EXECUTE statement name error
+----
+-- No. A-11-5-1
+SELECT pg_stat_statements_reset();
+ pg_stat_statements_reset 
+--------------------------
+(1 row)
+
+SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+ c1 | c2 | c3 | c4 
+----+----+----+----
+  1 |  1 |  1 | 1
+(1 row)
+
+/*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_seqscan off)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 
+----+----+----+----
+  1 |  1 |  1 | 1
+(1 row)
+
+/*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+ c1 | c2 | c3 | c4 
+----+----+----+----
+  1 |  1 |  1 | 1
+(1 row)
+
+SELECT s.query, s.calls
+  FROM public.pg_stat_statements s
+  JOIN pg_catalog.pg_database d
+    ON (s.dbid = d.oid)
+ ORDER BY 1;
+                query                 | calls 
+--------------------------------------+-------
+ SELECT * FROM s1.t1 WHERE t1.c1 = ?; |     3
+ SELECT pg_stat_statements_reset();   |     1
+(2 rows)
+
+----
+---- No. A-12-1 reset of global variable of core at the error
+---- No. A-12-2 reset of global variable of original at the error
+----
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+             QUERY PLAN             
+------------------------------------
+ Merge Join
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1
+   ->  Sort
+         Sort Key: t2.c1
+         ->  Seq Scan on t2
+(6 rows)
+
+/*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
+PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+EXPLAIN (COSTS false) EXECUTE p1;
+INFO:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL:  Relation name "t1" is duplicated.
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+MergeJoin(t1 t2)
+Set(enable_seqscan off)
+Set(geqo_threshold 100)
+not used hint:
+duplication hint:
+error hint:
+NestLoop(t1 t1)
+
+             QUERY PLAN             
+------------------------------------
+ Merge Join
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Sort
+         Sort Key: t1.c1
+         ->  Seq Scan on t1
+   ->  Index Scan using t2_i1 on t2
+(6 rows)
+
+-- No. A-12-1-1
+-- No. A-12-2-1
+SELECT name, setting FROM settings;
            name            |  setting  
 ---------------------------+-----------
  geqo                      | on
@@ -2591,6 +3426,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2599,13 +3435,13 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 SET pg_hint_plan.parse_messages TO error;
 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
-ERROR:  hint syntax error at or near "NestLoop(t1 t1)"
-DETAIL:  Relation name "t1" is duplicate.
+ERROR:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL:  Relation name "t1" is duplicated.
 SELECT name, setting FROM settings;
            name            |  setting  
 ---------------------------+-----------
@@ -2630,6 +3466,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2638,7 +3475,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
@@ -2652,14 +3489,14 @@ not used hint:
 duplication hint:
 error hint:
 
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Sort
          Sort Key: t1.c1
          ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t2_i1 on t2
 (6 rows)
 
 -- No. A-12-1-2
@@ -2688,6 +3525,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2696,13 +3534,13 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 SET pg_hint_plan.parse_messages TO error;
 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
-ERROR:  hint syntax error at or near "NestLoop(t1 t1)"
-DETAIL:  Relation name "t1" is duplicate.
+ERROR:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
+DETAIL:  Relation name "t1" is duplicated.
 SELECT name, setting FROM settings;
            name            |  setting  
 ---------------------------+-----------
@@ -2727,6 +3565,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2735,17 +3574,17 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 EXPLAIN (COSTS false) EXECUTE p1;
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Sort
          Sort Key: t1.c1
          ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t2_i1 on t2
 (6 rows)
 
 -- No. A-12-1-3
@@ -2774,6 +3613,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2782,7 +3622,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 SET pg_hint_plan.parse_messages TO error;
 EXPLAIN (COSTS false) EXECUTE p2;
@@ -2799,25 +3639,25 @@ not used hint:
 duplication hint:
 error hint:
 
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Sort
          Sort Key: t1.c1
          ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t2_i1 on t2
 (6 rows)
 
 EXPLAIN (COSTS false) EXECUTE p1;
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Sort
          Sort Key: t1.c1
          ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t2_i1 on t2
 (6 rows)
 
 SELECT name, setting FROM settings;
@@ -2844,6 +3684,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2852,7 +3693,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 -- No. A-12-1-4
 -- No. A-12-2-4
@@ -2880,6 +3721,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2888,20 +3730,20 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 SET pg_hint_plan.parse_messages TO error;
 EXPLAIN (COSTS false) EXECUTE p2;
 ERROR:  prepared statement "p2" does not exist
 EXPLAIN (COSTS false) EXECUTE p1;
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Sort
          Sort Key: t1.c1
          ->  Seq Scan on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t2_i1 on t2
 (6 rows)
 
 SELECT name, setting FROM settings;
@@ -2928,6 +3770,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | on
  enable_material           | on
  enable_mergejoin          | on
@@ -2936,7 +3779,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 DEALLOCATE p1;
 SET pg_hint_plan.parse_messages TO LOG;
@@ -2944,11 +3787,11 @@ SET pg_hint_plan.parse_messages TO LOG;
 ---- No. A-12-3 effective range of the hint
 ----
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
+   ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
          ->  Seq Scan on t2
@@ -2991,6 +3834,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | off
  enable_material           | on
  enable_mergejoin          | off
@@ -2999,7 +3843,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
@@ -3014,12 +3858,12 @@ not used hint:
 duplication hint:
 error hint:
 
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t1_i1 on t1
+   ->  Index Scan using t2_i1 on t2
 (4 rows)
 
 SELECT name, setting FROM settings;
@@ -3046,6 +3890,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | off
  enable_material           | on
  enable_mergejoin          | off
@@ -3054,7 +3899,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
           QUERY PLAN          
@@ -3103,6 +3948,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | off
  enable_material           | on
  enable_mergejoin          | off
@@ -3111,7 +3957,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 BEGIN;
 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
@@ -3127,12 +3973,12 @@ not used hint:
 duplication hint:
 error hint:
 
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t1_i1 on t1
+   ->  Index Scan using t2_i1 on t2
 (4 rows)
 
 COMMIT;
@@ -3161,6 +4007,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | off
  enable_material           | on
  enable_mergejoin          | off
@@ -3169,7 +4016,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
           QUERY PLAN          
@@ -3219,6 +4066,7 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
+ enable_indexonlyscan      | on
  enable_indexscan          | off
  enable_material           | on
  enable_mergejoin          | off
@@ -3227,7 +4075,7 @@ SELECT name, setting FROM settings;
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | log
-(29 rows)
+(30 rows)
 
 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
@@ -3242,15 +4090,17 @@ not used hint:
 duplication hint:
 error hint:
 
-              QUERY PLAN              
---------------------------------------
+             QUERY PLAN             
+------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
-   ->  Index Scan using t2_pkey on t2
+   ->  Index Scan using t1_i1 on t1
+   ->  Index Scan using t2_i1 on t2
 (4 rows)
 
 \connect
+SET enable_indexscan TO off;
+SET enable_mergejoin TO off;
 LOAD 'pg_hint_plan';
 SELECT name, setting FROM settings;
            name            |  setting  
@@ -3276,28 +4126,712 @@ SELECT name, setting FROM settings;
  enable_bitmapscan         | on
  enable_hashagg            | on
  enable_hashjoin           | on
- enable_indexscan          | on
+ enable_indexonlyscan      | on
+ enable_indexscan          | off
  enable_material           | on
- enable_mergejoin          | on
+ enable_mergejoin          | off
  enable_nestloop           | on
  enable_seqscan            | on
  enable_sort               | on
  enable_tidscan            | on
  client_min_messages       | notice
-(29 rows)
+(30 rows)
 
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+          QUERY PLAN          
+------------------------------
+ Hash Join
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Seq Scan on t1
+   ->  Hash
+         ->  Seq Scan on t2
+(5 rows)
+
+SET pg_hint_plan.enable_hint TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+RESET enable_indexscan;
+RESET enable_mergejoin;
+----
+---- No. A-13 call planner recursively
+----
+CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
+DECLARE
+    new_cnt int;
+BEGIN
+    RAISE NOTICE 'nested_planner(%)', cnt;
+
+    /* 再帰終了の判断 */
+    IF cnt <= 1 THEN
+        RETURN 0;
+    END IF;
+
+       SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1) INTO new_cnt
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+
+    RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+----
+---- No. A-13-2 use hint of main query
+----
+--No.13-2-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(1)
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_1)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(1)
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+        QUERY PLAN        
+--------------------------
+ Sort
+   Sort Key: c1
+   ->  Seq Scan on t1 t_1
+(3 rows)
+
+----
+---- No. A-13-3 output number of times of debugging log
+----
+--No.13-3-1
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(1)
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(1)
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-2
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(2)
+NOTICE:  nested_planner(1)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(2)
+NOTICE:  nested_planner(1)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-3-3
+--
+-- Redefine not to use cached plan
+--
+CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
+DECLARE
+    new_cnt int;
+BEGIN
+    RAISE NOTICE 'nested_planner(%)', cnt;
+
+    /* 再帰終了の判断 */
+    IF cnt <= 1 THEN
+        RETURN 0;
+    END IF;
+
+       SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1) INTO new_cnt
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+
+    RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(5)
+NOTICE:  nested_planner(4)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(3)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(2)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(1)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+no hint
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+no hint
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+/*+SeqScan(t_2)*/
+EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
+NOTICE:  nested_planner(5)
+NOTICE:  nested_planner(4)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(3)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(2)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+NOTICE:  nested_planner(1)
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+IndexScan(t_1)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+SeqScan(t_2)
+duplication hint:
+error hint:
+
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+----
+---- No. A-13-4 output of debugging log on hint status
+----
+CREATE OR REPLACE FUNCTION recall_planner() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+$$ LANGUAGE SQL IMMUTABLE;
+--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
               QUERY PLAN              
 --------------------------------------
+ Sort
+   Sort Key: t_1.c1
+   ->  Hash Join
+         Hash Cond: (t_1.c1 = t_2.c1)
+         ->  Seq Scan on t1 t_1
+         ->  Hash
+               ->  Seq Scan on t2 t_2
+(7 rows)
+
+--No.13-4-2
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 st_1
+   JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+  ORDER BY st_1.c1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(st_1 st_2)
+not used hint:
+duplication hint:
+error hint:
+
+               QUERY PLAN               
+----------------------------------------
+ Sort
+   Sort Key: st_1.c1
+   ->  Hash Join
+         Hash Cond: (st_1.c1 = st_2.c1)
+         ->  Seq Scan on t1 st_1
+         ->  Hash
+               ->  Seq Scan on t2 st_2
+(7 rows)
+
+--No.13-4-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 st_1
+   JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
+  ORDER BY st_1.c1;
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_2)
+duplication hint:
+error hint:
+
+                  QUERY PLAN                  
+----------------------------------------------
  Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_pkey on t1
+   Merge Cond: (st_1.c1 = st_2.c1)
+   ->  Index Only Scan using t1_i1 on t1 st_1
    ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
+         Sort Key: st_2.c1
+         ->  Seq Scan on t2 st_2
 (6 rows)
 
-SET pg_hint_plan.enable TO on;
-SET pg_hint_plan.debug_print TO on;
-SET client_min_messages TO LOG;
-SET search_path TO public;
+--No.13-4-4
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+                 QUERY PLAN                  
+---------------------------------------------
+ Merge Join
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Only Scan using t1_i1 on t1 t_1
+   ->  Sort
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-5
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 t_1
+  ORDER BY t_1.c1;
+INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+              QUERY PLAN               
+---------------------------------------
+ Index Only Scan using t1_i1 on t1 t_1
+(1 row)
+
+--No.13-4-6
+CREATE OR REPLACE FUNCTION recall_planner_one_t() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
+         FROM s1.t1 t_1
+        ORDER BY t_1.c1 LIMIT 1;
+$$ LANGUAGE SQL IMMUTABLE;
+EXPLAIN (COSTS false)
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+                 QUERY PLAN                  
+---------------------------------------------
+ Merge Join
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Only Scan using t1_i1 on t1 t_1
+   ->  Sort
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2
+(6 rows)
+
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner_one_t" during startup
+INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+                 QUERY PLAN                  
+---------------------------------------------
+ Merge Join
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Only Scan using t1_i1 on t1 t_1
+   ->  Sort
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2
+(6 rows)
+
+DROP FUNCTION recall_planner_one_t(int);
+ERROR:  function recall_planner_one_t(integer) does not exist
+--No.13-4-7
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT:  SQL function "recall_planner" during startup
+INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+                 QUERY PLAN                  
+---------------------------------------------
+ Merge Join
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Only Scan using t1_i1 on t1 t_1
+   ->  Sort
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2
+(6 rows)
+
+--No.13-4-8
+/*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT recall_planner() FROM s1.t1 t_1
+   JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+  ORDER BY t_1.c1;
+INFO:  pg_hint_plan: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL:  Conflict join method hint.
+INFO:  pg_hint_plan: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL:  Conflict join method hint.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+              QUERY PLAN              
+--------------------------------------
+ Sort
+   Sort Key: t_1.c1
+   ->  Hash Join
+         Hash Cond: (t_1.c1 = t_2.c1)
+         ->  Seq Scan on t1 t_1
+         ->  Hash
+               ->  Seq Scan on t2 t_2
+(7 rows)
+