OSDN Git Service

Improve error handling of Parallel hint
[pghintplan/pg_hint_plan.git] / expected / ut-L.out
index ef2edc7..f64ab95 100644 (file)
@@ -3,22 +3,24 @@ 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;
+SET max_parallel_workers_per_gather TO 0;
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 ----
 ---- No. L-1-1 specified pattern of the object name
@@ -33,22 +35,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-1-2
@@ -63,19 +65,20 @@ error hint:
 
                      QUERY PLAN                     
 ----------------------------------------------------
- Merge Join
-   Merge Cond: (t_1.c1 = t_2.c1)
+ Nested Loop
+   Join Filter: (t_1.c1 = t_4.c1)
    ->  Merge Join
-         Merge Cond: (t_1.c1 = t_4.c1)
+         Merge Cond: (t_1.c1 = t_2.c1)
          ->  Merge Join
                Merge Cond: (t_1.c1 = t_3.c1)
                ->  Index Scan using t1_i1 on t1 t_1
                ->  Index Scan using t3_i1 on t3 t_3
-         ->  Index Scan using t4_i1 on t4 t_4
-   ->  Sort
-         Sort Key: t_2.c1
-         ->  Seq Scan on t2 t_2
-(12 rows)
+         ->  Sort
+               Sort Key: t_2.c1
+               ->  Seq Scan on t2 t_2
+   ->  Index Scan using t4_i1 on t4 t_4
+         Index Cond: (c1 = t_3.c1)
+(13 rows)
 
 -- No. L-1-1-3
 /*+Leading(t_4 t_2 t_3 t_1)*/
@@ -87,22 +90,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                       QUERY PLAN                       
---------------------------------------------------------
+                     QUERY PLAN                     
+----------------------------------------------------
  Merge Join
    Merge Cond: (t_1.c1 = t_2.c1)
    ->  Index Scan using t1_i1 on t1 t_1
    ->  Sort
          Sort Key: t_2.c1
-         ->  Hash Join
-               Hash Cond: (t_3.c1 = t_2.c1)
-               ->  Seq Scan on t3 t_3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t_4.c1 = t_2.c1)
-                           ->  Seq Scan on t4 t_4
-                           ->  Hash
-                                 ->  Seq Scan on t2 t_2
+         ->  Nested Loop
+               Join Filter: (t_2.c1 = t_3.c1)
+               ->  Hash Join
+                     Hash Cond: (t_4.c1 = t_2.c1)
+                     ->  Seq Scan on t4 t_4
+                     ->  Hash
+                           ->  Seq Scan on t2 t_2
+               ->  Index Scan using t3_i1 on t3 t_3
+                     Index Cond: (c1 = t_4.c1)
 (14 rows)
 
 ----
@@ -118,22 +121,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-2-2
@@ -148,19 +151,20 @@ error hint:
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 ----
 ---- No. L-1-3 table doesn't exist in the hint option
@@ -175,22 +179,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-3-2
@@ -205,19 +209,20 @@ error hint:
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 ----
 ---- No. L-1-4 conflict table name
@@ -232,22 +237,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-4-2
@@ -255,22 +260,24 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 =
                    QUERY PLAN                   
 ------------------------------------------------
  Merge Join
-   Merge Cond: (s1.t1.c1 = s2.t1.c1)
+   Merge Cond: (t1.c1 = t1_1.c1)
    ->  Merge Join
-         Merge Cond: (s1.t1.c1 = t2.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
-               Merge Cond: (s1.t1.c1 = t3.c1)
+               Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t2_i1 on t2
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
    ->  Sort
-         Sort Key: s2.t1.c1
-         ->  Seq Scan on t1
-(12 rows)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1
+(14 rows)
 
 /*+Leading(t1 t2 t3 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
-INFO:  hint syntax error at or near "Leading(t1 t2 t3 t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t1 t2 t3 t1)"
 DETAIL:  Relation name "t1" is ambiguous.
 LOG:  pg_hint_plan:
 used hint:
@@ -282,18 +289,20 @@ Leading(t1 t2 t3 t1)
                    QUERY PLAN                   
 ------------------------------------------------
  Merge Join
-   Merge Cond: (s1.t1.c1 = s2.t1.c1)
+   Merge Cond: (t1.c1 = t1_1.c1)
    ->  Merge Join
-         Merge Cond: (s1.t1.c1 = t2.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
-               Merge Cond: (s1.t1.c1 = t3.c1)
+               Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t2_i1 on t2
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
    ->  Sort
-         Sort Key: s2.t1.c1
-         ->  Seq Scan on t1
-(12 rows)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1
+(14 rows)
 
 /*+Leading(s1.t1 t2 t3 s2.t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2.t1.c1;
@@ -307,18 +316,20 @@ error hint:
                    QUERY PLAN                   
 ------------------------------------------------
  Merge Join
-   Merge Cond: (s1.t1.c1 = s2.t1.c1)
+   Merge Cond: (t1.c1 = t1_1.c1)
    ->  Merge Join
-         Merge Cond: (s1.t1.c1 = t2.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
-               Merge Cond: (s1.t1.c1 = t3.c1)
+               Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t2_i1 on t2
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
    ->  Sort
-         Sort Key: s2.t1.c1
-         ->  Seq Scan on t1
-(12 rows)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1
+(14 rows)
 
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
                    QUERY PLAN                   
@@ -331,11 +342,13 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t2_i1 on t2
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
    ->  Sort
          Sort Key: s2t1.c1
          ->  Seq Scan on t1 s2t1
-(12 rows)
+(14 rows)
 
 /*+Leading(s2t1 t1 t3 t2)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s2.t1 s2t1 WHERE s1.t1.c1 = t2.c1 AND s1.t1.c1 = t3.c1 AND s1.t1.c1 = s2t1.c1;
@@ -346,53 +359,57 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                       
--------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Nested Loop
          ->  Merge Join
                Merge Cond: (t1.c1 = s2t1.c1)
                ->  Index Scan using t1_i1 on t1
-               ->  Index Scan using t1_pkey on t1 s2t1
+               ->  Sort
+                     Sort Key: s2t1.c1
+                     ->  Seq Scan on t1 s2t1
          ->  Index Scan using t3_i1 on t3
                Index Cond: (c1 = t1.c1)
    ->  Sort
          Sort Key: t2.c1
          ->  Seq Scan on t2
-(12 rows)
+(14 rows)
 
 -- No. L-1-4-3
 EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-                            QUERY PLAN                             
--------------------------------------------------------------------
- Merge Join
-   Merge Cond: (s1.t1.c1 = s1.t2.c1)
-   InitPlan 1 (returns $0)
+                               QUERY PLAN                               
+------------------------------------------------------------------------
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
+   InitPlan 1 (returns $1)
      ->  Aggregate
-           ->  Merge Join
-                 Merge Cond: (s1.t1.c1 = s1.t2.c1)
+           ->  Nested Loop
+                 Join Filter: (t1_1.c1 = t4_1.c1)
                  ->  Merge Join
-                       Merge Cond: (s1.t1.c1 = s1.t4.c1)
+                       Merge Cond: (t1_1.c1 = t2_1.c1)
                        ->  Merge Join
-                             Merge Cond: (s1.t1.c1 = s1.t3.c1)
-                             ->  Index Only Scan using t1_i1 on t1
-                             ->  Index Only Scan using t3_i1 on t3
-                       ->  Index Only Scan using t4_i1 on t4
-                 ->  Sort
-                       Sort Key: s1.t2.c1
-                       ->  Seq Scan on t2
+                             Merge Cond: (t1_1.c1 = t3_1.c1)
+                             ->  Index Only Scan using t1_i1 on t1 t1_1
+                             ->  Index Only Scan using t3_i1 on t3 t3_1
+                       ->  Sort
+                             Sort Key: t2_1.c1
+                             ->  Seq Scan on t2 t2_1
+                 ->  Index Only Scan using t4_i1 on t4 t4_1
+                       Index Cond: (c1 = t3_1.c1)
    ->  Merge Join
-         Merge Cond: (s1.t1.c1 = s1.t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
-               Merge Cond: (s1.t1.c1 = s1.t3.c1)
+               Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: s1.t2.c1
-         ->  Seq Scan on t2
-(26 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(28 rows)
 
 /*+Leading(t4 t2 t3 t1)*/
 EXPLAIN (COSTS false) SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1) FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
@@ -403,38 +420,38 @@ not used hint:
 duplication hint:
 error hint:
 
-                                QUERY PLAN                                
---------------------------------------------------------------------------
+                               QUERY PLAN                               
+------------------------------------------------------------------------
  Merge Join
-   Merge Cond: (s1.t1.c1 = s1.t2.c1)
-   InitPlan 1 (returns $0)
+   Merge Cond: (t1.c1 = t2.c1)
+   InitPlan 1 (returns $1)
      ->  Aggregate
            ->  Merge Join
-                 Merge Cond: (s1.t1.c1 = s1.t2.c1)
-                 ->  Index Only Scan using t1_i1 on t1
+                 Merge Cond: (t1_1.c1 = t2_1.c1)
+                 ->  Index Only Scan using t1_i1 on t1 t1_1
                  ->  Sort
-                       Sort Key: s1.t2.c1
-                       ->  Hash Join
-                             Hash Cond: (s1.t3.c1 = s1.t2.c1)
-                             ->  Seq Scan on t3
-                             ->  Hash
-                                   ->  Hash Join
-                                         Hash Cond: (s1.t4.c1 = s1.t2.c1)
-                                         ->  Seq Scan on t4
-                                         ->  Hash
-                                               ->  Seq Scan on t2
+                       Sort Key: t2_1.c1
+                       ->  Nested Loop
+                             Join Filter: (t2_1.c1 = t3_1.c1)
+                             ->  Hash Join
+                                   Hash Cond: (t4_1.c1 = t2_1.c1)
+                                   ->  Seq Scan on t4 t4_1
+                                   ->  Hash
+                                         ->  Seq Scan on t2 t2_1
+                             ->  Index Only Scan using t3_i1 on t3 t3_1
+                                   Index Cond: (c1 = t4_1.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
-         Sort Key: s1.t2.c1
-         ->  Hash Join
-               Hash Cond: (s1.t3.c1 = s1.t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (s1.t4.c1 = s1.t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         Sort Key: t2.c1
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (30 rows)
 
 /*+Leading(st1 st2 st3 st4)Leading(t4 t2 t3 t1)*/
@@ -454,15 +471,15 @@ error hint:
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
    SubPlan 1
      ->  Aggregate
            ->  Result
@@ -492,28 +509,28 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-5-2
 /*+Leading(t4 t2 t3 t1 t4)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading(t4 t2 t3 t1 t4)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t4 t2 t3 t1 t4)"
 DETAIL:  Relation name "t4" is duplicated.
 LOG:  pg_hint_plan:
 used hint:
@@ -524,23 +541,24 @@ Leading(t4 t2 t3 t1 t4)
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 /*+Leading(t4 t2 t3 t4)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading(t4 t2 t3 t4)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t4 t2 t3 t4)"
 DETAIL:  Relation name "t4" is duplicated.
 LOG:  pg_hint_plan:
 used hint:
@@ -551,24 +569,25 @@ Leading(t4 t2 t3 t4)
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 -- No. L-1-5-3
 /*+Leading(t4 t2 t3 t1 t4 t2 t3 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading(t4 t2 t3 t1 t4 t2 t3 t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t4 t2 t3 t1 t4 t2 t3 t1)"
 DETAIL:  Relation name "t4" is duplicated.
 LOG:  pg_hint_plan:
 used hint:
@@ -579,23 +598,24 @@ Leading(t4 t2 t3 t1 t4 t2 t3 t1)
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 /*+Leading(t4 t2 t2 t4)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading(t4 t2 t2 t4)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t4 t2 t2 t4)"
 DETAIL:  Relation name "t2" is duplicated.
 LOG:  pg_hint_plan:
 used hint:
@@ -606,19 +626,20 @@ Leading(t4 t2 t2 t4)
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 ----
 ---- No. L-1-6 object type for the hint
@@ -633,28 +654,28 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 -- No. L-1-6-2
 EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-                    QUERY PLAN                     
----------------------------------------------------
+                     QUERY PLAN                      
+-----------------------------------------------------
  Hash Join
    Hash Cond: (t1.c1 = t4.c1)
    ->  Hash Join
@@ -663,27 +684,27 @@ EXPLAIN (COSTS false) SELECT * FROM s1.p1 t1, s1.p1 t2, s1.p1 t3, s1.p1 t4 WHERE
                Hash Cond: (t1.c1 = t2.c1)
                ->  Append
                      ->  Seq Scan on p1 t1
-                     ->  Seq Scan on p1c1 t1
-                     ->  Seq Scan on p1c2 t1
-                     ->  Seq Scan on p1c3 t1
+                     ->  Seq Scan on p1c1 t1_1
+                     ->  Seq Scan on p1c2 t1_2
+                     ->  Seq Scan on p1c3 t1_3
                ->  Hash
                      ->  Append
                            ->  Seq Scan on p1 t2
-                           ->  Seq Scan on p1c1 t2
-                           ->  Seq Scan on p1c2 t2
-                           ->  Seq Scan on p1c3 t2
+                           ->  Seq Scan on p1c1 t2_1
+                           ->  Seq Scan on p1c2 t2_2
+                           ->  Seq Scan on p1c3 t2_3
          ->  Hash
                ->  Append
                      ->  Seq Scan on p1 t3
-                     ->  Seq Scan on p1c1 t3
-                     ->  Seq Scan on p1c2 t3
-                     ->  Seq Scan on p1c3 t3
+                     ->  Seq Scan on p1c1 t3_1
+                     ->  Seq Scan on p1c2 t3_2
+                     ->  Seq Scan on p1c3 t3_3
    ->  Hash
          ->  Append
                ->  Seq Scan on p1 t4
-               ->  Seq Scan on p1c1 t4
-               ->  Seq Scan on p1c2 t4
-               ->  Seq Scan on p1c3 t4
+               ->  Seq Scan on p1c1 t4_1
+               ->  Seq Scan on p1c2 t4_2
+               ->  Seq Scan on p1c3 t4_3
 (29 rows)
 
 /*+Leading(t4 t3 t2 t1)*/
@@ -695,8 +716,8 @@ not used hint:
 duplication hint:
 error hint:
 
-                    QUERY PLAN                     
----------------------------------------------------
+                     QUERY PLAN                      
+-----------------------------------------------------
  Hash Join
    Hash Cond: (t2.c1 = t1.c1)
    ->  Hash Join
@@ -705,27 +726,27 @@ error hint:
                Hash Cond: (t3.c1 = t4.c1)
                ->  Append
                      ->  Seq Scan on p1 t3
-                     ->  Seq Scan on p1c1 t3
-                     ->  Seq Scan on p1c2 t3
-                     ->  Seq Scan on p1c3 t3
+                     ->  Seq Scan on p1c1 t3_1
+                     ->  Seq Scan on p1c2 t3_2
+                     ->  Seq Scan on p1c3 t3_3
                ->  Hash
                      ->  Append
                            ->  Seq Scan on p1 t4
-                           ->  Seq Scan on p1c1 t4
-                           ->  Seq Scan on p1c2 t4
-                           ->  Seq Scan on p1c3 t4
+                           ->  Seq Scan on p1c1 t4_1
+                           ->  Seq Scan on p1c2 t4_2
+                           ->  Seq Scan on p1c3 t4_3
          ->  Hash
                ->  Append
                      ->  Seq Scan on p1 t2
-                     ->  Seq Scan on p1c1 t2
-                     ->  Seq Scan on p1c2 t2
-                     ->  Seq Scan on p1c3 t2
+                     ->  Seq Scan on p1c1 t2_1
+                     ->  Seq Scan on p1c2 t2_2
+                     ->  Seq Scan on p1c3 t2_3
    ->  Hash
          ->  Append
                ->  Seq Scan on p1 t1
-               ->  Seq Scan on p1c1 t1
-               ->  Seq Scan on p1c2 t1
-               ->  Seq Scan on p1c3 t1
+               ->  Seq Scan on p1c1 t1_1
+               ->  Seq Scan on p1c2 t1_2
+               ->  Seq Scan on p1c3 t1_3
 (29 rows)
 
 -- No. L-1-6-3
@@ -775,7 +796,6 @@ error hint:
 
 -- No. L-1-6-4
 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
-NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "tm1_pkey" for table "tm1"
 EXPLAIN (COSTS false) SELECT * FROM tm1 t1, tm1 t2, tm1 t3, tm1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
                  QUERY PLAN                 
 --------------------------------------------
@@ -907,7 +927,7 @@ error hint:
 (10 rows)
 
 -- No. L-1-6-8
-EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
                       QUERY PLAN                       
 -------------------------------------------------------
  Nested Loop
@@ -926,7 +946,7 @@ EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4),
 (13 rows)
 
 /*+Leading(t4 t3 t2 t1)*/
-EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+EXPLAIN (COSTS false) SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t1 (c1, c2, c3, c4), s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -1040,21 +1060,21 @@ error hint:
 
 -- No. L-1-6-10
 EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1 t2, s1.v1 t3, s1.v1 t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-                  QUERY PLAN                  
-----------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Hash Join
-   Hash Cond: (v1t1.c1 = v1t1.c1)
+   Hash Cond: (v1t1.c1 = v1t1_3.c1)
    ->  Hash Join
-         Hash Cond: (v1t1.c1 = v1t1.c1)
+         Hash Cond: (v1t1.c1 = v1t1_2.c1)
          ->  Hash Join
-               Hash Cond: (v1t1.c1 = v1t1.c1)
+               Hash Cond: (v1t1.c1 = v1t1_1.c1)
                ->  Seq Scan on t1 v1t1
                ->  Hash
-                     ->  Seq Scan on t1 v1t1
+                     ->  Seq Scan on t1 v1t1_1
          ->  Hash
-               ->  Seq Scan on t1 v1t1
+               ->  Seq Scan on t1 v1t1_2
    ->  Hash
-         ->  Seq Scan on t1 v1t1
+         ->  Seq Scan on t1 v1t1_3
 (13 rows)
 
 /*+Leading(t4 t3 t2 t1)*/
@@ -1066,21 +1086,21 @@ Leading(t4 t3 t2 t1)
 duplication hint:
 error hint:
 
-                  QUERY PLAN                  
-----------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Hash Join
-   Hash Cond: (v1t1.c1 = v1t1.c1)
+   Hash Cond: (v1t1.c1 = v1t1_3.c1)
    ->  Hash Join
-         Hash Cond: (v1t1.c1 = v1t1.c1)
+         Hash Cond: (v1t1.c1 = v1t1_2.c1)
          ->  Hash Join
-               Hash Cond: (v1t1.c1 = v1t1.c1)
+               Hash Cond: (v1t1.c1 = v1t1_1.c1)
                ->  Seq Scan on t1 v1t1
                ->  Hash
-                     ->  Seq Scan on t1 v1t1
+                     ->  Seq Scan on t1 v1t1_1
          ->  Hash
-               ->  Seq Scan on t1 v1t1
+               ->  Seq Scan on t1 v1t1_2
    ->  Hash
-         ->  Seq Scan on t1 v1t1
+         ->  Seq Scan on t1 v1t1_3
 (13 rows)
 
 EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
@@ -1131,19 +1151,20 @@ error hint:
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Only Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Only Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 /*+Leading(st4 t2 t3 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
@@ -1156,19 +1177,20 @@ error hint:
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Only Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Only Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 /*+Leading(t4 t2 t3 t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, (SELECT t4.c1 FROM s1.t4) st4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = st4.c1;
@@ -1179,22 +1201,22 @@ not used hint:
 duplication hint:
 error hint:
 
-                      QUERY PLAN                      
-------------------------------------------------------
+                   QUERY PLAN                   
+------------------------------------------------
  Merge Join
    Merge Cond: (t1.c1 = t2.c1)
    ->  Index Scan using t1_i1 on t1
    ->  Sort
          Sort Key: t2.c1
-         ->  Hash Join
-               Hash Cond: (t3.c1 = t2.c1)
-               ->  Seq Scan on t3
-               ->  Hash
-                     ->  Hash Join
-                           Hash Cond: (t4.c1 = t2.c1)
-                           ->  Seq Scan on t4
-                           ->  Hash
-                                 ->  Seq Scan on t2
+         ->  Nested Loop
+               Join Filter: (t2.c1 = t3.c1)
+               ->  Hash Join
+                     Hash Cond: (t4.c1 = t2.c1)
+                     ->  Seq Scan on t4
+                     ->  Hash
+                           ->  Seq Scan on t2
+               ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t4.c1)
 (14 rows)
 
 ----
@@ -2715,7 +2737,7 @@ SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
                    ->  Tid Scan on t1 b2t1
                          TID Cond: (ctid = '(1,1)'::tid)
                          Filter: ((c1 IS NOT NULL) AND (c1 = 1))
-   InitPlan 4 (returns $3)
+   InitPlan 4 (returns $4)
      ->  Aggregate
            ->  Tid Scan on t1 b3t1
                  TID Cond: (ctid = '(1,1)'::tid)
@@ -2729,7 +2751,7 @@ SELECT max(b3t1.c1) FROM s1.t1 b3t1 WHERE b3t1.ctid = '(1,1)'
                            Join Filter: (bmt1.c1 = bmt2.c1)
                            ->  Tid Scan on t1 bmt1
                                  TID Cond: (ctid = '(1,1)'::tid)
-                                 Filter: (c1 <> $3)
+                                 Filter: (c1 <> $4)
                            ->  Seq Scan on t2 bmt2
                                  Filter: (ctid = '(1,1)'::tid)
                      ->  Tid Scan on t3 bmt3
@@ -2789,7 +2811,7 @@ error hint:
                    ->  Tid Scan on t1 b2t1
                          TID Cond: (ctid = '(1,1)'::tid)
                          Filter: ((c1 IS NOT NULL) AND (c1 = 1))
-   InitPlan 4 (returns $3)
+   InitPlan 4 (returns $4)
      ->  Aggregate
            ->  Tid Scan on t1 b3t1
                  TID Cond: (ctid = '(1,1)'::tid)
@@ -2810,7 +2832,7 @@ error hint:
                      Filter: (ctid = '(1,1)'::tid)
          ->  Tid Scan on t1 bmt1
                TID Cond: (ctid = '(1,1)'::tid)
-               Filter: (c1 <> $3)
+               Filter: (c1 <> $4)
 (46 rows)
 
 ----
@@ -3454,18 +3476,18 @@ error hint:
 
 -- No. L-2-3-4
 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
-            QUERY PLAN            
-----------------------------------
+             QUERY PLAN             
+------------------------------------
  Hash Join
-   Hash Cond: (v1t1.c1 = v1t1.c1)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
    ->  Seq Scan on t1 v1t1
    ->  Hash
-         ->  Seq Scan on t1 v1t1
+         ->  Seq Scan on t1 v1t1_1
 (5 rows)
 
 /*+Leading(v1t1 v1t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
-INFO:  hint syntax error at or near "Leading(v1t1 v1t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(v1t1 v1t1)"
 DETAIL:  Relation name "v1t1" is ambiguous.
 LOG:  pg_hint_plan:
 used hint:
@@ -3474,13 +3496,13 @@ duplication hint:
 error hint:
 Leading(v1t1 v1t1)
 
-            QUERY PLAN            
-----------------------------------
+             QUERY PLAN             
+------------------------------------
  Hash Join
-   Hash Cond: (v1t1.c1 = v1t1.c1)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
    ->  Seq Scan on t1 v1t1
    ->  Hash
-         ->  Seq Scan on t1 v1t1
+         ->  Seq Scan on t1 v1t1_1
 (5 rows)
 
 -- No. L-2-3-5
@@ -3514,18 +3536,18 @@ error hint:
 
 -- No. L-2-3-6
 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
-            QUERY PLAN            
-----------------------------------
+             QUERY PLAN             
+------------------------------------
  Hash Join
-   Hash Cond: (r4t1.c1 = r4t1.c1)
+   Hash Cond: (r4t1.c1 = r4t1_1.c1)
    ->  Seq Scan on t1 r4t1
    ->  Hash
-         ->  Seq Scan on t1 r4t1
+         ->  Seq Scan on t1 r4t1_1
 (5 rows)
 
 /*+Leading(r4t1 r4t1)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
-INFO:  hint syntax error at or near "Leading(r4t1 r4t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(r4t1 r4t1)"
 DETAIL:  Relation name "r4t1" is ambiguous.
 LOG:  pg_hint_plan:
 used hint:
@@ -3534,13 +3556,13 @@ duplication hint:
 error hint:
 Leading(r4t1 r4t1)
 
-            QUERY PLAN            
-----------------------------------
+             QUERY PLAN             
+------------------------------------
  Hash Join
-   Hash Cond: (r4t1.c1 = r4t1.c1)
+   Hash Cond: (r4t1.c1 = r4t1_1.c1)
    ->  Seq Scan on t1 r4t1
    ->  Hash
-         ->  Seq Scan on t1 r4t1
+         ->  Seq Scan on t1 r4t1_1
 (5 rows)
 
 -- No. L-2-3-7
@@ -3576,7 +3598,7 @@ error hint:
 ---- No. L-2-4 VALUES clause
 ----
 -- No. L-2-4-1
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
                    QUERY PLAN                    
 -------------------------------------------------
  Nested Loop
@@ -3590,7 +3612,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1,
 (8 rows)
 
 /*+ Leading(t3 t1 t2) */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -3611,7 +3633,7 @@ error hint:
 (8 rows)
 
 /*+ Leading(*VALUES* t1 t2) */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
 LOG:  pg_hint_plan:
 used hint:
 Leading(*VALUES* t1 t2)
@@ -3631,24 +3653,25 @@ error hint:
 (7 rows)
 
 -- No. L-2-4-2
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
                       QUERY PLAN                       
 -------------------------------------------------------
  Nested Loop
-   Join Filter: (t1.c1 = "*VALUES*".column1)
    ->  Nested Loop
+         Join Filter: (t2.c1 = "*VALUES*_1".column1)
          ->  Hash Join
                Hash Cond: (t2.c1 = "*VALUES*".column1)
                ->  Seq Scan on t2
                ->  Hash
                      ->  Values Scan on "*VALUES*"
-         ->  Index Scan using t1_i1 on t1
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*"
-(11 rows)
+         ->  Materialize
+               ->  Values Scan on "*VALUES*_1"
+   ->  Index Scan using t1_i1 on t1
+         Index Cond: (c1 = t2.c1)
+(12 rows)
 
 /*+ Leading(t4 t3 t2 t1) */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -3659,21 +3682,22 @@ error hint:
                       QUERY PLAN                       
 -------------------------------------------------------
  Nested Loop
-   Join Filter: (t1.c1 = "*VALUES*".column1)
    ->  Nested Loop
+         Join Filter: (t2.c1 = "*VALUES*_1".column1)
          ->  Hash Join
                Hash Cond: (t2.c1 = "*VALUES*".column1)
                ->  Seq Scan on t2
                ->  Hash
                      ->  Values Scan on "*VALUES*"
-         ->  Index Scan using t1_i1 on t1
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*"
-(11 rows)
+         ->  Materialize
+               ->  Values Scan on "*VALUES*_1"
+   ->  Index Scan using t1_i1 on t1
+         Index Cond: (c1 = t2.c1)
+(12 rows)
 
 /*+ Leading(*VALUES* t3 t2 t1) */
-EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading(*VALUES* t3 t2 t1) "
+EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t3 (c1, c2, c3, c4), (VALUES(1,1,1,'1'), (2,2,2,'2')) AS t4 (c1, c2, c3, c4) WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(*VALUES* t3 t2 t1) "
 DETAIL:  Relation name "*VALUES*" is ambiguous.
 LOG:  pg_hint_plan:
 used hint:
@@ -3685,17 +3709,18 @@ Leading(*VALUES* t3 t2 t1)
                       QUERY PLAN                       
 -------------------------------------------------------
  Nested Loop
-   Join Filter: (t1.c1 = "*VALUES*".column1)
    ->  Nested Loop
+         Join Filter: (t2.c1 = "*VALUES*_1".column1)
          ->  Hash Join
                Hash Cond: (t2.c1 = "*VALUES*".column1)
                ->  Seq Scan on t2
                ->  Hash
                      ->  Values Scan on "*VALUES*"
-         ->  Index Scan using t1_i1 on t1
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*"
-(11 rows)
+         ->  Materialize
+               ->  Values Scan on "*VALUES*_1"
+   ->  Index Scan using t1_i1 on t1
+         Index Cond: (c1 = t2.c1)
+(12 rows)
 
 ----
 ---- No. L-3-1 leading the order of table joins
@@ -3747,19 +3772,18 @@ not used hint:
 duplication hint:
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t1.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
-(10 rows)
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
+(9 rows)
 
 ----
 ---- No. L-3-2 GUC parameter to disable hints
@@ -3816,19 +3840,18 @@ not used hint:
 duplication hint:
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t1.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
-(10 rows)
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
+(9 rows)
 
 Reset geqo_threshold;
 -- No. L-3-2-3
@@ -3960,18 +3983,18 @@ Set join_collapse_limit = 3;
 EXPLAIN (COSTS false) SELECT * FROM s1.t3
   JOIN s1.t2 ON (t3.c1 = t2.c1)
   JOIN s1.t1 ON (t1.c1 = t3.c1);
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t2.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   Join Filter: (t2.c1 = t3.c1)
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
 (10 rows)
 
 /*+Leading(t1 t2 t3)*/
@@ -3985,18 +4008,18 @@ not used hint:
 duplication hint:
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t2.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   Join Filter: (t2.c1 = t3.c1)
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
 (10 rows)
 
 Reset join_collapse_limit;
@@ -4015,26 +4038,26 @@ not used hint:
 duplication hint:
 error hint:
 
-                  QUERY PLAN                   
------------------------------------------------
+                   QUERY PLAN                    
+-------------------------------------------------
  Hash Join
    Hash Cond: (t1.c1 = t3.c1)
    ->  Hash Join
          Hash Cond: (t1.c1 = t2.c1)
          ->  Append
                ->  Seq Scan on p2c1 t1
-               ->  Seq Scan on p2c1c1 t1
-               ->  Seq Scan on p2c1c2 t1
+               ->  Seq Scan on p2c1c1 t1_1
+               ->  Seq Scan on p2c1c2 t1_2
          ->  Hash
                ->  Append
                      ->  Seq Scan on p2c2 t2
-                     ->  Seq Scan on p2c2c1 t2
-                     ->  Seq Scan on p2c2c2 t2
+                     ->  Seq Scan on p2c2c1 t2_1
+                     ->  Seq Scan on p2c2c2 t2_2
    ->  Hash
          ->  Append
                ->  Seq Scan on p2c3 t3
-               ->  Seq Scan on p2c3c1 t3
-               ->  Seq Scan on p2c3c2 t3
+               ->  Seq Scan on p2c3c1 t3_1
+               ->  Seq Scan on p2c3c2 t3_2
 (18 rows)
 
 -- No. L-3-3-2
@@ -4049,26 +4072,26 @@ Leading(p2c1c1 p2c2c1 p2c3c1)
 duplication hint:
 error hint:
 
-                  QUERY PLAN                   
------------------------------------------------
+                   QUERY PLAN                    
+-------------------------------------------------
  Hash Join
    Hash Cond: (t1.c1 = t3.c1)
    ->  Hash Join
          Hash Cond: (t1.c1 = t2.c1)
          ->  Append
                ->  Seq Scan on p2c1 t1
-               ->  Seq Scan on p2c1c1 t1
-               ->  Seq Scan on p2c1c2 t1
+               ->  Seq Scan on p2c1c1 t1_1
+               ->  Seq Scan on p2c1c2 t1_2
          ->  Hash
                ->  Append
                      ->  Seq Scan on p2c2 t2
-                     ->  Seq Scan on p2c2c1 t2
-                     ->  Seq Scan on p2c2c2 t2
+                     ->  Seq Scan on p2c2c1 t2_1
+                     ->  Seq Scan on p2c2c2 t2_2
    ->  Hash
          ->  Append
                ->  Seq Scan on p2c3 t3
-               ->  Seq Scan on p2c3c1 t3
-               ->  Seq Scan on p2c3c2 t3
+               ->  Seq Scan on p2c3c1 t3_1
+               ->  Seq Scan on p2c3c2 t3_2
 (18 rows)
 
 ----
@@ -4095,7 +4118,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
 DETAIL:  Conflict leading hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -4105,28 +4128,27 @@ duplication hint:
 Leading(t2 t3 t1)
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t1.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
-(10 rows)
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
+(9 rows)
 
 -- No. L-3-4-2
 /*+Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading(t1 t2 t3)"
 DETAIL:  Conflict leading hint.
-INFO:  hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t2 t3 t1)Leading(t1 t2 t3)"
 DETAIL:  Conflict leading hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -4137,26 +4159,25 @@ Leading(t3 t1 t2)
 Leading(t2 t3 t1)
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t1.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
-(10 rows)
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
+(9 rows)
 
 -- No. L-3-4-3
 /*+Leading(t2 t3 t1)Leading()*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading()"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading()"
 DETAIL:  Leading hint requires at least two relations.
 LOG:  pg_hint_plan:
 used hint:
@@ -4185,9 +4206,9 @@ Leading()
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading()"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading()"
 DETAIL:  Leading hint requires at least two relations.
-INFO:  hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t3 t1 t2)Leading(t2 t3 t1)Leading()"
 DETAIL:  Conflict leading hint.
 LOG:  pg_hint_plan:
 used hint:
@@ -4220,7 +4241,7 @@ Leading()
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading()"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading()"
 DETAIL:  Leading hint requires at least two relations.
 LOG:  pg_hint_plan:
 used hint:
@@ -4247,7 +4268,7 @@ Leading()
 EXPLAIN (COSTS false) SELECT * FROM s1.t1
   JOIN s1.t2 ON (t1.c1 = t2.c1)
   JOIN s1.t3 ON (t1.c1 = t3.c1);
-INFO:  hint syntax error at or near "Leading(t1)"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading(t1)"
 DETAIL:  Leading hint requires at least two relations.
 LOG:  pg_hint_plan:
 used hint:
@@ -4306,19 +4327,18 @@ not used hint:
 duplication hint:
 error hint:
 
-                   QUERY PLAN                   
-------------------------------------------------
- Hash Join
-   Hash Cond: (t3.c1 = t1.c1)
-   ->  Seq Scan on t3
-   ->  Hash
-         ->  Merge Join
-               Merge Cond: (t1.c1 = t2.c1)
-               ->  Index Scan using t1_i1 on t1
-               ->  Sort
-                     Sort Key: t2.c1
-                     ->  Seq Scan on t2
-(10 rows)
+                QUERY PLAN                
+------------------------------------------
+ Nested Loop
+   ->  Merge Join
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Index Scan using t1_i1 on t1
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t3_i1 on t3
+         Index Cond: (c1 = t1.c1)
+(9 rows)
 
 ----
 ---- No. L-3-6 specified Inner/Outer side
@@ -4326,7 +4346,7 @@ error hint:
 -- No. L-3-6-1
 /*+Leading((t2))*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading((t2))"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading((t2))"
 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
 LOG:  pg_hint_plan:
 used hint:
@@ -4337,19 +4357,20 @@ Leading((t2))
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 -- No. L-3-6-2
 /*+Leading((t2 t3))*/
@@ -4367,10 +4388,10 @@ error hint:
    Join Filter: (t1.c1 = t4.c1)
    ->  Nested Loop
          Join Filter: (t2.c1 = t1.c1)
-         ->  Merge Join
-               Merge Cond: (t2.c1 = t3.c1)
+         ->  Nested Loop
                ->  Index Scan using t2_i1 on t2
                ->  Index Scan using t3_i1 on t3
+                     Index Cond: (c1 = t2.c1)
          ->  Index Scan using t1_i1 on t1
                Index Cond: (c1 = t3.c1)
    ->  Index Scan using t4_i1 on t4
@@ -4380,7 +4401,7 @@ error hint:
 -- No. L-3-6-3
 /*+Leading((t2 t3 t4))*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near "Leading((t2 t3 t4))"
+INFO:  pg_hint_plan: hint syntax error at or near "Leading((t2 t3 t4))"
 DETAIL:  Leading hint requires two sets of relations when parentheses nests.
 LOG:  pg_hint_plan:
 used hint:
@@ -4391,19 +4412,20 @@ Leading((t2 t3 t4))
 
                    QUERY PLAN                   
 ------------------------------------------------
- Merge Join
-   Merge Cond: (t1.c1 = t2.c1)
+ Nested Loop
+   Join Filter: (t1.c1 = t4.c1)
    ->  Merge Join
-         Merge Cond: (t1.c1 = t4.c1)
+         Merge Cond: (t1.c1 = t2.c1)
          ->  Merge Join
                Merge Cond: (t1.c1 = t3.c1)
                ->  Index Scan using t1_i1 on t1
                ->  Index Scan using t3_i1 on t3
-         ->  Index Scan using t4_i1 on t4
-   ->  Sort
-         Sort Key: t2.c1
-         ->  Seq Scan on t2
-(12 rows)
+         ->  Sort
+               Sort Key: t2.c1
+               ->  Seq Scan on t2
+   ->  Index Scan using t4_i1 on t4
+         Index Cond: (c1 = t3.c1)
+(13 rows)
 
 -- No. L-3-6-4
 /*+Leading(((t1 t2) (t3 t4)))*/
@@ -4436,7 +4458,7 @@ error hint:
 -- No. L-3-6-5
 /*+Leading((((t1 t3) t4) t2)))*/
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2, s1.t3, s1.t4 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1 AND t1.c1 = t4.c1;
-INFO:  hint syntax error at or near ")"
+INFO:  pg_hint_plan: hint syntax error at or near ")"
 DETAIL:  Unrecognized hint keyword ")".
 LOG:  pg_hint_plan:
 used hint: