OSDN Git Service

Interim support for 9.4beta2. pg_stat_statements.c is replaced with the latest versio...
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Thu, 4 Sep 2014 02:03:08 +0000 (11:03 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Fri, 5 Sep 2014 04:26:11 +0000 (13:26 +0900)
83 files changed:
Makefile
expected/R_1-1-1.out [deleted file]
expected/R_1-1-2.out [deleted file]
expected/R_1-1-3.out [deleted file]
expected/R_1-2-1.out [deleted file]
expected/R_1-2-2.out [deleted file]
expected/R_1-3-1.out [deleted file]
expected/R_1-3-2.out [deleted file]
expected/R_1-4-1.out [deleted file]
expected/R_1-4-2.out [deleted file]
expected/R_1-4-3.out [deleted file]
expected/R_1-5-1.out [deleted file]
expected/R_1-5-2.out [deleted file]
expected/R_1-5-3.out [deleted file]
expected/R_1-6-1.out [deleted file]
expected/R_1-6-10.out [deleted file]
expected/R_1-6-11.out [deleted file]
expected/R_1-6-2.out [deleted file]
expected/R_1-6-3.out [deleted file]
expected/R_1-6-4.out [deleted file]
expected/R_1-6-5.out [deleted file]
expected/R_1-6-6.out [deleted file]
expected/R_1-6-7.out [deleted file]
expected/R_1-6-8.out [deleted file]
expected/R_1-6-9.out [deleted file]
expected/R_1-7-1.out [deleted file]
expected/R_1-7-2.out [deleted file]
expected/R_1-7-3.out [deleted file]
expected/R_2-1-1.out [deleted file]
expected/R_2-1-2.out [deleted file]
expected/R_2-1-3.out [deleted file]
expected/R_2-1-4.out [deleted file]
expected/R_2-1-5.out [deleted file]
expected/R_2-1-6.out [deleted file]
expected/R_2-1-7.out [deleted file]
expected/R_2-1-8.out [deleted file]
expected/R_2-2-1.out [deleted file]
expected/R_2-2-2.out [deleted file]
expected/R_2-2-3.out [deleted file]
expected/R_2-2-4.out [deleted file]
expected/R_2-3-1.out [deleted file]
expected/R_2-3-2.out [deleted file]
expected/R_2-3-3.out [deleted file]
expected/R_2-3-4.out [deleted file]
expected/R_2-3-5.out [deleted file]
expected/R_2-3-6.out [deleted file]
expected/R_2-3-7.out [deleted file]
expected/R_2-4-1.out [deleted file]
expected/R_2-4-2.out [deleted file]
expected/R_2-5-1.out [deleted file]
expected/R_2-5-2.out [deleted file]
expected/R_2-5-3.out [deleted file]
expected/R_3-1-1.out [deleted file]
expected/R_3-1-2.out [deleted file]
expected/R_3-2-1.out [deleted file]
expected/R_3-2-2.out [deleted file]
expected/R_3-2-3.out [deleted file]
expected/R_3-3-1.out [deleted file]
expected/R_3-3-2.out [deleted file]
expected/R_3-3-3.out [deleted file]
expected/R_3-4-1.out [deleted file]
expected/R_3-4-2.out [deleted file]
expected/R_3-5-1.out [deleted file]
expected/R_3-5-2.out [deleted file]
expected/R_3-5-3.out [deleted file]
expected/R_3-5-4.out [deleted file]
expected/R_3-6-1.out [deleted file]
expected/init.out
expected/pg_hint_plan.out
expected/ut-A.out
expected/ut-J.out
expected/ut-R.out
expected/ut-S.out
input/ut-fdw.source
output/ut-fdw.source
pg_stat_statements.c
sql/init.sql
sql/maskout.sh [new file with mode: 0755]
sql/pg_hint_plan.sql
sql/ut-A.sql
sql/ut-J.sql
sql/ut-R.sql
sql/ut-S.sql

index b7ecc09..3b7c3f2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,4 +23,4 @@ include $(PGXS)
 installcheck: $(REGRESSION_EXPECTED)
 
 # pg_hint_plan.c includes core.c and make_join_rel.c
-pg_hint_plan.o: core.c make_join_rel.c pg_stat_statements.c
+pg_hint_plan.o: core.c make_join_rel.c pg_stat_statements.c
diff --git a/expected/R_1-1-1.out b/expected/R_1-1-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-1-2.out b/expected/R_1-1-2.out
deleted file mode 100644 (file)
index 5c3a3aa..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                  QUERY PLAN                                   
--------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t_1.c1 = t_2.c1)
-   ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t_2.c1
-         ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-1-3.out b/expected/R_1-1-3.out
deleted file mode 100644 (file)
index f144591..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                  QUERY PLAN                                   
--------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t_1.c1 = t_2.c1)
-   ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t_2.c1
-         ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-2-1.out b/expected/R_1-2-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-2-2.out b/expected/R_1-2-2.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-3-1.out b/expected/R_1-3-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-3-2.out b/expected/R_1-3-2.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-4-1.out b/expected/R_1-4-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-4-2.out b/expected/R_1-4-2.out
deleted file mode 100644 (file)
index 3ad0467..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t1_1.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t1_1.c1
-         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t1_1.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t1_1.c1
-         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t1_1.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t1_1.c1
-         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = s2t1.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: s2t1.c1
-         ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = s2t1.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: s2t1.c1
-         ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-4-3.out b/expected/R_1-4-3.out
deleted file mode 100644 (file)
index 512cbf8..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-                                            QUERY PLAN                                            
---------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   InitPlan 1 (returns $0)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Merge Join  (cost=xxx rows=100 width=4)
-                 Merge Cond: (t1_1.c1 = t2_1.c1)
-                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=4)
-                 ->  Sort  (cost=xxx rows=100 width=4)
-                       Sort Key: t2_1.c1
-                       ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(14 rows)
-
-                                            QUERY PLAN                                            
---------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   InitPlan 1 (returns $0)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Merge Join  (cost=xxx rows=1 width=4)
-                 Merge Cond: (t1_1.c1 = t2_1.c1)
-                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=4)
-                 ->  Sort  (cost=xxx rows=100 width=4)
-                       Sort Key: t2_1.c1
-                       ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(14 rows)
-
-                                           QUERY PLAN                                            
--------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   InitPlan 1 (returns $0)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Merge Join  (cost=xxx rows=1 width=4)
-                 Merge Cond: (st1.c1 = st2.c1)
-                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=4)
-                 ->  Sort  (cost=xxx rows=100 width=4)
-                       Sort Key: st2.c1
-                       ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(14 rows)
-
diff --git a/expected/R_1-5-1.out b/expected/R_1-5-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-5-2.out b/expected/R_1-5-2.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-5-3.out b/expected/R_1-5-3.out
deleted file mode 100644 (file)
index 4099d55..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                   QUERY PLAN                                    
----------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=73)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Merge Join  (cost=xxx rows=1000 width=59)
-         Merge Cond: (t1.c1 = t3.c1)
-         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-         ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1100 width=44)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(9 rows)
-
-                                      QUERY PLAN                                       
----------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=100 width=117)
-   Join Filter: (t1.c1 = t4.c1)
-   ->  Merge Join  (cost=xxx rows=100 width=73)
-         Merge Cond: (t1.c1 = t2.c1)
-         ->  Merge Join  (cost=xxx rows=1000 width=59)
-               Merge Cond: (t1.c1 = t3.c1)
-               ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-               ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1100 width=44)
-         ->  Sort  (cost=xxx rows=100 width=14)
-               Sort Key: t2.c1
-               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-   ->  Index Scan using t4_i1 on t4  (cost=xxx rows=1 width=44)
-         Index Cond: (c1 = t3.c1)
-(13 rows)
-
diff --git a/expected/R_1-6-1.out b/expected/R_1-6-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-6-10.out b/expected/R_1-6-10.out
deleted file mode 100644 (file)
index c3d2a1b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (v1t1.c1 = v1t1_1.c1)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (v1t1.c1 = v1t1_1.c1)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
-                               QUERY PLAN                                
--------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=30)
-   Hash Cond: (v1t1.c1 = v1t1_.c1)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 v1t1_  (cost=xxx rows=1000 width=15)
-(5 rows)
-
diff --git a/expected/R_1-6-11.out b/expected/R_1-6-11.out
deleted file mode 100644 (file)
index 5a87c39..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=19)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=4)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=4)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=19)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=4)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=4)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=19)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=4)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=4)
-(6 rows)
-
diff --git a/expected/R_1-6-2.out b/expected/R_1-6-2.out
deleted file mode 100644 (file)
index c4e43b3..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-                                  QUERY PLAN                                  
-------------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=301 width=30)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Append  (cost=xxx rows=301 width=15)
-         ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=14)
-         ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=16)
-         ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=16)
-(13 rows)
-
-                                  QUERY PLAN                                  
-------------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=30)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Append  (cost=xxx rows=301 width=15)
-         ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=14)
-         ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=16)
-         ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=16)
-(13 rows)
-
diff --git a/expected/R_1-6-3.out b/expected/R_1-6-3.out
deleted file mode 100644 (file)
index 802dc0a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-                              QUERY PLAN                               
------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1100 width=88)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Seq Scan on ul1 t1  (cost=xxx rows=1100 width=44)
-   ->  Hash  (cost=xxx rows=1100 width=44)
-         ->  Seq Scan on ul1 t2  (cost=xxx rows=1100 width=44)
-(5 rows)
-
-                              QUERY PLAN                               
------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=88)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Seq Scan on ul1 t1  (cost=xxx rows=1100 width=44)
-   ->  Hash  (cost=xxx rows=1100 width=44)
-         ->  Seq Scan on ul1 t2  (cost=xxx rows=1100 width=44)
-(5 rows)
-
diff --git a/expected/R_1-6-4.out b/expected/R_1-6-4.out
deleted file mode 100644 (file)
index 48e218d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-                              QUERY PLAN                               
------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1100 width=88)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Seq Scan on tm1 t1  (cost=xxx rows=1100 width=44)
-   ->  Hash  (cost=xxx rows=1100 width=44)
-         ->  Seq Scan on tm1 t2  (cost=xxx rows=1100 width=44)
-(5 rows)
-
-                              QUERY PLAN                               
------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=88)
-   Hash Cond: (t1.c1 = t2.c1)
-   ->  Seq Scan on tm1 t1  (cost=xxx rows=1100 width=44)
-   ->  Hash  (cost=xxx rows=1100 width=44)
-         ->  Seq Scan on tm1 t2  (cost=xxx rows=1100 width=44)
-(5 rows)
-
diff --git a/expected/R_1-6-5.out b/expected/R_1-6-5.out
deleted file mode 100644 (file)
index f302331..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=620 width=406)
-   Hash Cond: (t1.oid = t2.oid)
-   ->  Seq Scan on pg_class t1  (cost=xxx rows=620 width=207)
-   ->  Hash  (cost=xxx rows=620 width=207)
-         ->  Seq Scan on pg_class t2  (cost=xxx rows=620 width=207)
-(5 rows)
-
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=406)
-   Hash Cond: (t1.oid = t2.oid)
-   ->  Seq Scan on pg_class t1  (cost=xxx rows=620 width=207)
-   ->  Hash  (cost=xxx rows=620 width=207)
-         ->  Seq Scan on pg_class t2  (cost=xxx rows=620 width=207)
-(5 rows)
-
diff --git a/expected/R_1-6-6.out b/expected/R_1-6-6.out
deleted file mode 100644 (file)
index 96077de..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
- Nested Loop  (cost=xxx rows=1 width=31)
-   ->  Nested Loop  (cost=xxx rows=1 width=16)
-         Join Filter: (ft_1.id = ft_2.id)
-         ->  Foreign Scan on ft1 ft_1  (cost=xxx rows=1 width=8)
-               Foreign File: @pg_hint_plan@/data/data.csv
-               Foreign File Size: 42
-         ->  Foreign Scan on ft1 ft_2  (cost=xxx rows=1 width=8)
-               Foreign File: @pg_hint_plan@/data/data.csv
-               Foreign File Size: 42
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = ft_1.id)
-
diff --git a/expected/R_1-6-7.out b/expected/R_1-6-7.out
deleted file mode 100644 (file)
index 4d43f1b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-                           QUERY PLAN                            
------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=88)
-   Join Filter: (t1.c1 = t2.c1)
-   ->  Function Scan on f1 t1  (cost=xxx rows=1 width=44)
-   ->  Function Scan on f1 t2  (cost=xxx rows=1 width=44)
-(4 rows)
-
-                           QUERY PLAN                            
------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=88)
-   Join Filter: (t1.c1 = t2.c1)
-   ->  Function Scan on f1 t1  (cost=xxx rows=1 width=44)
-   ->  Function Scan on f1 t2  (cost=xxx rows=1 width=44)
-(4 rows)
-
diff --git a/expected/R_1-6-8.out b/expected/R_1-6-8.out
deleted file mode 100644 (file)
index 85df7a4..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=3 width=58)
-   Hash Cond: (t2.c1 = "*VALUES*".column1)
-   ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-   ->  Hash  (cost=xxx rows=3 width=44)
-         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=44)
-(5 rows)
-
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=3 width=58)
-   Hash Cond: (t2.c1 = "*VALUES*".column1)
-   ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-   ->  Hash  (cost=xxx rows=3 width=44)
-         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=44)
-(5 rows)
-
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=58)
-   Hash Cond: (t2.c1 = "*VALUES*".column1)
-   ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-   ->  Hash  (cost=xxx rows=3 width=44)
-         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=44)
-(5 rows)
-
diff --git a/expected/R_1-6-9.out b/expected/R_1-6-9.out
deleted file mode 100644 (file)
index 925245e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-                                            QUERY PLAN                                            
---------------------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=19)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Merge Join  (cost=xxx rows=100 width=4)
-                 Merge Cond: (t1_1.c1 = t2.c1)
-                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=4)
-                 ->  Sort  (cost=xxx rows=100 width=4)
-                       Sort Key: t2.c1
-                       ->  Seq Scan on t2  (cost=xxx rows=100 width=4)
-   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = c1.c1)
-(12 rows)
-
-                                            QUERY PLAN                                            
---------------------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=2 width=19)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Merge Join  (cost=xxx rows=1 width=4)
-                 Merge Cond: (t1_1.c1 = t2.c1)
-                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=4)
-                 ->  Sort  (cost=xxx rows=100 width=4)
-                       Sort Key: t2.c1
-                       ->  Seq Scan on t2  (cost=xxx rows=100 width=4)
-   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = c1.c1)
-(12 rows)
-
diff --git a/expected/R_1-7-1.out b/expected/R_1-7-1.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-7-2.out b/expected/R_1-7-2.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_1-7-3.out b/expected/R_1-7-3.out
deleted file mode 100644 (file)
index bbad821..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_2-1-1.out b/expected/R_2-1-1.out
deleted file mode 100644 (file)
index 0cdebe6..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Nested Loop  (cost=xxx rows=100 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=8)
-                     ->  Merge Join  (cost=xxx rows=100 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(44 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=8)
-                     ->  Merge Join  (cost=xxx rows=1 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(44 rows)
-
diff --git a/expected/R_2-1-2.out b/expected/R_2-1-2.out
deleted file mode 100644 (file)
index 8f42fc3..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   InitPlan 3 (returns $5)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1000 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=100 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=8)
-                     ->  Merge Join  (cost=xxx rows=100 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(58 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   InitPlan 3 (returns $5)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=8)
-                     ->  Merge Join  (cost=xxx rows=1 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(58 rows)
-
diff --git a/expected/R_2-1-3.out b/expected/R_2-1-3.out
deleted file mode 100644 (file)
index 1c39755..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-                                          QUERY PLAN                                           
------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Merge Join  (cost=xxx rows=100 width=4)
-         Merge Cond: (bmt1.c1 = bmt2.c1)
-         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-         ->  Sort  (cost=xxx rows=100 width=12)
-               Sort Key: bmt2.c1
-               ->  Hash Join  (cost=xxx rows=100 width=12)
-                     Hash Cond: (bmt3.c1 = bmt2.c1)
-                     ->  Hash Join  (cost=xxx rows=1100 width=8)
-                           Hash Cond: (bmt3.c1 = bmt4.c1)
-                           ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                           ->  Hash  (cost=xxx rows=1100 width=4)
-                                 ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=100 width=4)
-                           ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-(15 rows)
-
-                                         QUERY PLAN                                         
---------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt2.c1 = bmt1.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               ->  Hash Join  (cost=xxx rows=1 width=8)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1100 width=4)
-                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(13 rows)
-
diff --git a/expected/R_2-1-4.out b/expected/R_2-1-4.out
deleted file mode 100644 (file)
index 1c39755..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-                                          QUERY PLAN                                           
------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Merge Join  (cost=xxx rows=100 width=4)
-         Merge Cond: (bmt1.c1 = bmt2.c1)
-         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-         ->  Sort  (cost=xxx rows=100 width=12)
-               Sort Key: bmt2.c1
-               ->  Hash Join  (cost=xxx rows=100 width=12)
-                     Hash Cond: (bmt3.c1 = bmt2.c1)
-                     ->  Hash Join  (cost=xxx rows=1100 width=8)
-                           Hash Cond: (bmt3.c1 = bmt4.c1)
-                           ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                           ->  Hash  (cost=xxx rows=1100 width=4)
-                                 ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=100 width=4)
-                           ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-(15 rows)
-
-                                         QUERY PLAN                                         
---------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt2.c1 = bmt1.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               ->  Hash Join  (cost=xxx rows=1 width=8)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1100 width=4)
-                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(13 rows)
-
diff --git a/expected/R_2-1-5.out b/expected/R_2-1-5.out
deleted file mode 100644 (file)
index 040907c..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Nested Loop  (cost=xxx rows=100 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=8)
-                     ->  Merge Join  (cost=xxx rows=100 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=4)
-                                 Filter: ((c1 <> $1) AND (c1 <> $3))
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(45 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=8)
-                     ->  Merge Join  (cost=xxx rows=1 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=4)
-                                 Filter: ((c1 <> $1) AND (c1 <> $3))
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(45 rows)
-
diff --git a/expected/R_2-1-6.out b/expected/R_2-1-6.out
deleted file mode 100644 (file)
index 967cabe..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   InitPlan 3 (returns $5)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1000 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=100 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=8)
-                     ->  Merge Join  (cost=xxx rows=100 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=4)
-                                 Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(59 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   InitPlan 3 (returns $5)
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=12)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=8)
-                     ->  Merge Join  (cost=xxx rows=1 width=8)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=4)
-                                 Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(59 rows)
-
diff --git a/expected/R_2-1-7.out b/expected/R_2-1-7.out
deleted file mode 100644 (file)
index ba10ec1..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   CTE c2
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Hash Join  (cost=xxx rows=1 width=4)
-         Hash Cond: (bmt4.c1 = bmt1.c1)
-         ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-         ->  Hash  (cost=xxx rows=1 width=20)
-               ->  Merge Join  (cost=xxx rows=1 width=20)
-                     Merge Cond: (bmt3.c1 = bmt1.c1)
-                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Sort  (cost=xxx rows=1 width=16)
-                           Sort Key: bmt1.c1
-                           ->  Nested Loop  (cost=xxx rows=1 width=16)
-                                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                                       Hash Cond: (bmt1.c1 = c1.c1)
-                                       ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=4)
-                                       ->  Hash  (cost=xxx rows=1 width=8)
-                                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                                   Merge Cond: (c1.c1 = c2.c1)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c1.c1
-                                                         ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c2.c1
-                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=4)
-                                 ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                                       Index Cond: (c1 = bmt1.c1)
-(54 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   CTE c2
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   ->  Hash Join  (cost=xxx rows=1 width=4)
-         Hash Cond: (bmt4.c1 = bmt1.c1)
-         ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-         ->  Hash  (cost=xxx rows=1 width=20)
-               ->  Merge Join  (cost=xxx rows=1 width=20)
-                     Merge Cond: (bmt3.c1 = bmt1.c1)
-                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Sort  (cost=xxx rows=1 width=16)
-                           Sort Key: bmt1.c1
-                           ->  Nested Loop  (cost=xxx rows=1 width=16)
-                                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                                       Hash Cond: (bmt1.c1 = c1.c1)
-                                       ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=4)
-                                       ->  Hash  (cost=xxx rows=1 width=8)
-                                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                                   Merge Cond: (c1.c1 = c2.c1)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c1.c1
-                                                         ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c2.c1
-                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=4)
-                                 ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                                       Index Cond: (c1 = bmt1.c1)
-(54 rows)
-
diff --git a/expected/R_2-1-8.out b/expected/R_2-1-8.out
deleted file mode 100644 (file)
index 946f5c0..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=8)
-                             ->  Merge Join  (cost=xxx rows=100 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   CTE c2
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 ->  Hash Join  (cost=xxx rows=1000 width=12)
-                       Hash Cond: (b2t3.c1 = b2t1.c1)
-                       ->  Merge Join  (cost=xxx rows=1100 width=8)
-                             Merge Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1000 width=4)
-                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   CTE c3
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=100 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=100 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1000 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=24)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=20)
-                     ->  Merge Join  (cost=xxx rows=1 width=20)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Sort  (cost=xxx rows=1 width=16)
-                                 Sort Key: bmt1.c1
-                                 ->  Nested Loop  (cost=xxx rows=1 width=16)
-                                       ->  Hash Join  (cost=xxx rows=1 width=12)
-                                             Hash Cond: (c2.c1 = c1.c1)
-                                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                                   Merge Cond: (c2.c1 = c3.c1)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c2.c1
-                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=4)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c3.c1
-                                                         ->  CTE Scan on c3  (cost=xxx rows=1 width=4)
-                                             ->  Hash  (cost=xxx rows=1 width=4)
-                                                   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-                                       ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-                                             Index Cond: (c1 = c1.c1)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(74 rows)
-
-                                                     QUERY PLAN                                                     
---------------------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b1t2.c1 = b1t1.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b1t4.c1 = b1t2.c1)
-                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b1t3.c1 = b1t2.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                                   ->  Sort  (cost=xxx rows=100 width=4)
-                                         Sort Key: b1t2.c1
-                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b1t3.c1)
-   CTE c2
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b2t1.c1 = b2t3.c1)
-                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=4)
-                       ->  Hash  (cost=xxx rows=1 width=8)
-                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                   Merge Cond: (b2t3.c1 = b2t4.c1)
-                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=4)
-                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=4)
-                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b2t1.c1)
-   CTE c3
-     ->  Aggregate  (cost=xxx rows=1 width=4)
-           ->  Nested Loop  (cost=xxx rows=1 width=4)
-                 Join Filter: (b3t1.c1 = b3t3.c1)
-                 ->  Hash Join  (cost=xxx rows=1 width=12)
-                       Hash Cond: (b3t1.c1 = b3t2.c1)
-                       ->  Merge Join  (cost=xxx rows=1 width=8)
-                             Merge Cond: (b3t1.c1 = b3t4.c1)
-                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Hash  (cost=xxx rows=100 width=4)
-                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=4)
-                       Index Cond: (c1 = b3t4.c1)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Hash Join  (cost=xxx rows=1 width=24)
-               Hash Cond: (bmt3.c1 = bmt1.c1)
-               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=1 width=20)
-                     ->  Merge Join  (cost=xxx rows=1 width=20)
-                           Merge Cond: (bmt1.c1 = bmt2.c1)
-                           ->  Sort  (cost=xxx rows=1 width=16)
-                                 Sort Key: bmt1.c1
-                                 ->  Nested Loop  (cost=xxx rows=1 width=16)
-                                       ->  Hash Join  (cost=xxx rows=1 width=12)
-                                             Hash Cond: (c2.c1 = c1.c1)
-                                             ->  Merge Join  (cost=xxx rows=1 width=8)
-                                                   Merge Cond: (c2.c1 = c3.c1)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c2.c1
-                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=4)
-                                                   ->  Sort  (cost=xxx rows=1 width=4)
-                                                         Sort Key: c3.c1
-                                                         ->  CTE Scan on c3  (cost=xxx rows=1 width=4)
-                                             ->  Hash  (cost=xxx rows=1 width=4)
-                                                   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-                                       ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-                                             Index Cond: (c1 = c1.c1)
-                           ->  Sort  (cost=xxx rows=100 width=4)
-                                 Sort Key: bmt2.c1
-                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(74 rows)
-
diff --git a/expected/R_2-2-1.out b/expected/R_2-2-1.out
deleted file mode 100644 (file)
index b3b4374..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-                                    QUERY PLAN                                    
-----------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 2 (returns $1)
-     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 3 (returns $2)
-     ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-         Index Cond: (c1 = 1)
-         Filter: (c1 <> $2)
-   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-         Filter: (c1 = 1)
-(15 rows)
-
-                                    QUERY PLAN                                    
-----------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=4)
-   CTE c1
-     ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 2 (returns $1)
-     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 3 (returns $2)
-     ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=4)
-         Index Cond: (c1 = 1)
-         Filter: (c1 <> $2)
-   ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-         Filter: (c1 = 1)
-(15 rows)
-
diff --git a/expected/R_2-2-2.out b/expected/R_2-2-2.out
deleted file mode 100644 (file)
index bb3304e..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-                                         QUERY PLAN                                         
---------------------------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=10 width=4)
-   Hash Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b1t1.c1 = b1t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b1t2.c1
-                 ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-   InitPlan 2 (returns $1)
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b2t1.c1 = b2t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b2t2.c1
-                 ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=4)
-   InitPlan 3 (returns $2)
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b3t1.c1 = b3t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b3t2.c1
-                 ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-   ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $2)
-   ->  Hash  (cost=xxx rows=100 width=8)
-         ->  Merge Join  (cost=xxx rows=100 width=8)
-               Merge Cond: (bmt2.c1 = c1.c1)
-               ->  Sort  (cost=xxx rows=100 width=4)
-                     Sort Key: bmt2.c1
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-               ->  Sort  (cost=xxx rows=100 width=4)
-                     Sort Key: c1.c1
-                     ->  CTE Scan on c1  (cost=xxx rows=100 width=4)
-(34 rows)
-
-                                         QUERY PLAN                                         
---------------------------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=4)
-   Hash Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b1t1.c1 = b1t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b1t2.c1
-                 ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-   InitPlan 2 (returns $1)
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b2t1.c1 = b2t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b2t2.c1
-                 ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=4)
-   InitPlan 3 (returns $2)
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b3t1.c1 = b3t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=4)
-                 Sort Key: b3t2.c1
-                 ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=4)
-   ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $2)
-   ->  Hash  (cost=xxx rows=1 width=8)
-         ->  Merge Join  (cost=xxx rows=1 width=8)
-               Merge Cond: (bmt2.c1 = c1.c1)
-               ->  Sort  (cost=xxx rows=100 width=4)
-                     Sort Key: bmt2.c1
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-               ->  Sort  (cost=xxx rows=1 width=4)
-                     Sort Key: c1.c1
-                     ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-(34 rows)
-
diff --git a/expected/R_2-2-3.out b/expected/R_2-2-3.out
deleted file mode 100644 (file)
index 2b838e5..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-                                                    QUERY PLAN                                                    
-------------------------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=10 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b1t1.c1 = b1t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=12)
-                 Sort Key: b1t2.c1
-                 ->  Nested Loop  (cost=xxx rows=100 width=12)
-                       ->  Hash Join  (cost=xxx rows=1100 width=8)
-                             Hash Cond: (b1t3.c1 = b1t4.c1)
-                             ->  Seq Scan on t3 b1t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b2t1.c1 = b2t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=12)
-                 Sort Key: b2t2.c1
-                 ->  Nested Loop  (cost=xxx rows=100 width=12)
-                       ->  Hash Join  (cost=xxx rows=1100 width=8)
-                             Hash Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Seq Scan on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b2t3.c1)
-   InitPlan 3 (returns $5)
-     ->  Merge Join  (cost=xxx rows=100 width=4)
-           Merge Cond: (b3t1.c1 = b3t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=100 width=12)
-                 Sort Key: b3t2.c1
-                 ->  Nested Loop  (cost=xxx rows=100 width=12)
-                       ->  Hash Join  (cost=xxx rows=1100 width=8)
-                             Hash Cond: (b3t3.c1 = b3t4.c1)
-                             ->  Seq Scan on t3 b3t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b3t3.c1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $5)
-   ->  Sort  (cost=xxx rows=100 width=16)
-         Sort Key: bmt2.c1
-         ->  Nested Loop  (cost=xxx rows=100 width=16)
-               ->  Hash Join  (cost=xxx rows=100 width=12)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=100 width=8)
-                           ->  Merge Join  (cost=xxx rows=100 width=8)
-                                 Merge Cond: (bmt4.c1 = c1.c1)
-                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=4)
-                                 ->  Sort  (cost=xxx rows=100 width=4)
-                                       Sort Key: c1.c1
-                                       ->  CTE Scan on c1  (cost=xxx rows=100 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-(61 rows)
-
-                                                    QUERY PLAN                                                    
-------------------------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b1t1.c1 = b1t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=1 width=12)
-                 Sort Key: b1t2.c1
-                 ->  Nested Loop  (cost=xxx rows=1 width=12)
-                       ->  Hash Join  (cost=xxx rows=1 width=8)
-                             Hash Cond: (b1t3.c1 = b1t4.c1)
-                             ->  Seq Scan on t3 b1t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $3)
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b2t1.c1 = b2t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=1 width=12)
-                 Sort Key: b2t2.c1
-                 ->  Nested Loop  (cost=xxx rows=1 width=12)
-                       ->  Hash Join  (cost=xxx rows=1 width=8)
-                             Hash Cond: (b2t3.c1 = b2t4.c1)
-                             ->  Seq Scan on t3 b2t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b2t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b2t3.c1)
-   InitPlan 3 (returns $5)
-     ->  Merge Join  (cost=xxx rows=1 width=4)
-           Merge Cond: (b3t1.c1 = b3t2.c1)
-           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=4)
-           ->  Sort  (cost=xxx rows=1 width=12)
-                 Sort Key: b3t2.c1
-                 ->  Nested Loop  (cost=xxx rows=1 width=12)
-                       ->  Hash Join  (cost=xxx rows=1 width=8)
-                             Hash Cond: (b3t3.c1 = b3t4.c1)
-                             ->  Seq Scan on t3 b3t3  (cost=xxx rows=1100 width=4)
-                             ->  Hash  (cost=xxx rows=1100 width=4)
-                                   ->  Seq Scan on t4 b3t4  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=4)
-                             Index Cond: (c1 = b3t3.c1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $5)
-   ->  Sort  (cost=xxx rows=1 width=16)
-         Sort Key: bmt2.c1
-         ->  Nested Loop  (cost=xxx rows=1 width=16)
-               ->  Hash Join  (cost=xxx rows=1 width=12)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1 width=8)
-                           ->  Merge Join  (cost=xxx rows=1 width=8)
-                                 Merge Cond: (bmt4.c1 = c1.c1)
-                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=4)
-                                 ->  Sort  (cost=xxx rows=1 width=4)
-                                       Sort Key: c1.c1
-                                       ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-(61 rows)
-
diff --git a/expected/R_2-2-4.out b/expected/R_2-2-4.out
deleted file mode 100644 (file)
index 38bc790..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-                                                    QUERY PLAN                                                    
-------------------------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=10 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Nested Loop  (cost=xxx rows=100 width=4)
-           Join Filter: (b1t2.c1 = b1t1.c1)
-           ->  Hash Join  (cost=xxx rows=100 width=12)
-                 Hash Cond: (b1t3.c1 = b1t2.c1)
-                 ->  Merge Join  (cost=xxx rows=1100 width=8)
-                       Merge Cond: (b1t3.c1 = b1t4.c1)
-                       ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1100 width=4)
-                 ->  Hash  (cost=xxx rows=100 width=4)
-                       ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                 Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $2)
-     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 3 (returns $3)
-     ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=4)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $3)
-   ->  Sort  (cost=xxx rows=100 width=16)
-         Sort Key: bmt2.c1
-         ->  Nested Loop  (cost=xxx rows=100 width=16)
-               ->  Hash Join  (cost=xxx rows=100 width=12)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=100 width=8)
-                           ->  Merge Join  (cost=xxx rows=100 width=8)
-                                 Merge Cond: (bmt4.c1 = c1.c1)
-                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=4)
-                                 ->  Sort  (cost=xxx rows=100 width=4)
-                                       Sort Key: c1.c1
-                                       ->  CTE Scan on c1  (cost=xxx rows=100 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-(37 rows)
-
-                                                    QUERY PLAN                                                    
-------------------------------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   CTE c1
-     ->  Nested Loop  (cost=xxx rows=1 width=4)
-           Join Filter: (b1t2.c1 = b1t1.c1)
-           ->  Hash Join  (cost=xxx rows=1 width=12)
-                 Hash Cond: (b1t3.c1 = b1t2.c1)
-                 ->  Merge Join  (cost=xxx rows=1 width=8)
-                       Merge Cond: (b1t3.c1 = b1t4.c1)
-                       ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=4)
-                       ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1100 width=4)
-                 ->  Hash  (cost=xxx rows=100 width=4)
-                       ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=4)
-           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                 Index Cond: (c1 = b1t3.c1)
-   InitPlan 2 (returns $2)
-     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-           Index Cond: (c1 = 1)
-   InitPlan 3 (returns $3)
-     ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=4)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=4)
-         Filter: (c1 <> $3)
-   ->  Sort  (cost=xxx rows=1 width=16)
-         Sort Key: bmt2.c1
-         ->  Nested Loop  (cost=xxx rows=1 width=16)
-               ->  Hash Join  (cost=xxx rows=1 width=12)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1 width=8)
-                           ->  Merge Join  (cost=xxx rows=1 width=8)
-                                 Merge Cond: (bmt4.c1 = c1.c1)
-                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=4)
-                                 ->  Sort  (cost=xxx rows=1 width=4)
-                                       Sort Key: c1.c1
-                                       ->  CTE Scan on c1  (cost=xxx rows=1 width=4)
-               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=4)
-                     Index Cond: (c1 = bmt3.c1)
-(37 rows)
-
diff --git a/expected/R_2-3-1.out b/expected/R_2-3-1.out
deleted file mode 100644 (file)
index 151ef06..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-                                          QUERY PLAN                                           
------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r1  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(20 rows)
-
-                                   QUERY PLAN                                    
----------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r1  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(18 rows)
-
-                                             QUERY PLAN                                             
-----------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b1t1.c1 = b1t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r1_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b1t2.c1
-                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(20 rows)
-
-                                     QUERY PLAN                                      
--------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b1t1.c1 = b1t2.c1)
-                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r1_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(18 rows)
-
diff --git a/expected/R_2-3-2.out b/expected/R_2-3-2.out
deleted file mode 100644 (file)
index b6f2fbd..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-                                          QUERY PLAN                                           
------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(41 rows)
-
-                                   QUERY PLAN                                    
----------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(37 rows)
-
-                                             QUERY PLAN                                             
-----------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b1t1.c1 = b1t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b1t2.c1
-                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b2t1.c1 = b2t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b2t1.c1 = b2t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b2t1.c1 = b2t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b2t2.c1
-                           ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(41 rows)
-
-                                     QUERY PLAN                                      
--------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b1t1.c1 = b1t2.c1)
-                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b2t1.c1 = b2t4.c1)
-         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b2t1.c1 = b2t3.c1)
-               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b2t1.c1 = b2t2.c1)
-                     ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(37 rows)
-
diff --git a/expected/R_2-3-3.out b/expected/R_2-3-3.out
deleted file mode 100644 (file)
index 07dda1b..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-                                          QUERY PLAN                                           
------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (t1.c1 = t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: t2.c1
-                           ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(62 rows)
-
-                                   QUERY PLAN                                    
----------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (t1.c1 = t4.c1)
-         ->  Tid Scan on t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (t1.c1 = t3.c1)
-               ->  Tid Scan on t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (t1.c1 = t2.c1)
-                     ->  Seq Scan on t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(56 rows)
-
-                                             QUERY PLAN                                             
-----------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b1t1.c1 = b1t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b1t2.c1
-                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b2t1.c1 = b2t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b2t1.c1 = b2t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b2t1.c1 = b2t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b2t2.c1
-                           ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=1 width=4)
-         Join Filter: (b3t1.c1 = b3t4.c1)
-         ->  Nested Loop  (cost=xxx rows=1 width=12)
-               Join Filter: (b3t1.c1 = b3t3.c1)
-               ->  Merge Join  (cost=xxx rows=1 width=8)
-                     Merge Cond: (b3t1.c1 = b3t2.c1)
-                     ->  Nested Loop  (cost=xxx rows=6 width=4)
-                           ->  Index Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-                     ->  Sort  (cost=xxx rows=1 width=4)
-                           Sort Key: b3t2.c1
-                           ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=4)
-                                 Filter: (ctid = '(1,1)'::tid)
-               ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-         ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-(62 rows)
-
-                                     QUERY PLAN                                      
--------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b1t1.c1 = b1t4.c1)
-         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b1t1.c1 = b1t3.c1)
-               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b1t1.c1 = b1t2.c1)
-                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b2t1.c1 = b2t4.c1)
-         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b2t1.c1 = b2t3.c1)
-               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b2t1.c1 = b2t2.c1)
-                     ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=2 width=4)
-         Join Filter: (b3t1.c1 = b3t4.c1)
-         ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=4)
-               TID Cond: (ctid = '(1,1)'::tid)
-         ->  Nested Loop  (cost=xxx rows=2 width=12)
-               Join Filter: (b3t1.c1 = b3t3.c1)
-               ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=4)
-                     TID Cond: (ctid = '(1,1)'::tid)
-               ->  Nested Loop  (cost=xxx rows=2 width=8)
-                     Join Filter: (b3t1.c1 = b3t2.c1)
-                     ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=4)
-                           Filter: (ctid = '(1,1)'::tid)
-                     ->  Nested Loop  (cost=xxx rows=2 width=4)
-                           ->  Tid Scan on t1 b3t1  (cost=xxx rows=1 width=4)
-                                 TID Cond: (ctid = '(1,1)'::tid)
-                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=0)
-                                 Filter: (c1 = 1)
-(56 rows)
-
diff --git a/expected/R_2-3-4.out b/expected/R_2-3-4.out
deleted file mode 100644 (file)
index 171b55e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (v1t1.c1 = v1t1_1.c1)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (v1t1.c1 = v1t1_1.c1)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
diff --git a/expected/R_2-3-5.out b/expected/R_2-3-5.out
deleted file mode 100644 (file)
index 01a379f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-                                 QUERY PLAN                                  
------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1000 width=30)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = v1t1.c1)
-(4 rows)
-
-                                 QUERY PLAN                                  
------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=30)
-   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=15)
-   ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = v1t1.c1)
-(4 rows)
-
diff --git a/expected/R_2-3-6.out b/expected/R_2-3-6.out
deleted file mode 100644 (file)
index c3f9bc8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (r4t1.c1 = r4t1_1.c1)
-   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
-                                QUERY PLAN                                
---------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1000 width=30)
-   Hash Cond: (r4t1.c1 = r4t1_1.c1)
-   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=15)
-   ->  Hash  (cost=xxx rows=1000 width=15)
-         ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=15)
-(5 rows)
-
diff --git a/expected/R_2-3-7.out b/expected/R_2-3-7.out
deleted file mode 100644 (file)
index 7b5aaf4..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1000 width=30)
-   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=15)
-   ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = r4t1.c1)
-(4 rows)
-
-                                 QUERY PLAN                                 
-----------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=30)
-   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=15)
-   ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = r4t1.c1)
-(4 rows)
-
diff --git a/expected/R_2-4-1.out b/expected/R_2-4-1.out
deleted file mode 100644 (file)
index f6018a5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-                                   QUERY PLAN                                   
---------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=73)
-   ->  Hash Join  (cost=xxx rows=1 width=58)
-         Hash Cond: (t2.c1 = "*VALUES*".column1)
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-         ->  Hash  (cost=xxx rows=1 width=44)
-               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = t2.c1)
-(8 rows)
-
-                                   QUERY PLAN                                   
---------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=73)
-   ->  Hash Join  (cost=xxx rows=1 width=58)
-         Hash Cond: (t2.c1 = "*VALUES*".column1)
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-         ->  Hash  (cost=xxx rows=1 width=44)
-               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-         Index Cond: (c1 = t2.c1)
-(8 rows)
-
-                                 QUERY PLAN                                  
------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=73)
-   ->  Nested Loop  (cost=xxx rows=2 width=59)
-         ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-               Index Cond: (c1 = "*VALUES*".column1)
-   ->  Index Scan using t2_i1 on t2  (cost=xxx rows=1 width=14)
-         Index Cond: (c1 = t1.c1)
-(7 rows)
-
diff --git a/expected/R_2-4-2.out b/expected/R_2-4-2.out
deleted file mode 100644 (file)
index 10489ef..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-                                      QUERY PLAN                                      
---------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=117)
-   Join Filter: (t1.c1 = "*VALUES*_1".column1)
-   ->  Nested Loop  (cost=xxx rows=1 width=73)
-         ->  Hash Join  (cost=xxx rows=1 width=58)
-               Hash Cond: (t2.c1 = "*VALUES*".column1)
-               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-               ->  Hash  (cost=xxx rows=1 width=44)
-                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
-(11 rows)
-
-                                      QUERY PLAN                                      
---------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=117)
-   Join Filter: (t1.c1 = "*VALUES*_1".column1)
-   ->  Nested Loop  (cost=xxx rows=1 width=73)
-         ->  Hash Join  (cost=xxx rows=1 width=58)
-               Hash Cond: (t2.c1 = "*VALUES*".column1)
-               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-               ->  Hash  (cost=xxx rows=1 width=44)
-                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
-(11 rows)
-
-                                      QUERY PLAN                                      
---------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=1 width=117)
-   Join Filter: (t1.c1 = "*VALUES*_1".column1)
-   ->  Nested Loop  (cost=xxx rows=1 width=73)
-         ->  Hash Join  (cost=xxx rows=1 width=58)
-               Hash Cond: (t2.c1 = "*VALUES*".column1)
-               ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-               ->  Hash  (cost=xxx rows=1 width=44)
-                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=44)
-         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=15)
-               Index Cond: (c1 = t2.c1)
-   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=44)
-(11 rows)
-
diff --git a/expected/R_2-5-1.out b/expected/R_2-5-1.out
deleted file mode 100644 (file)
index 3d3f19b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-                                              QUERY PLAN                                              
-------------------------------------------------------------------------------------------------------
- Aggregate  (cost=xxx rows=1 width=4)
-   ->  Nested Loop  (cost=xxx rows=100 width=4)
-         Join Filter: (bmt1.c1 = bmt4.c1)
-         ->  Merge Join  (cost=xxx rows=100 width=12)
-               Merge Cond: (bmt1.c1 = bmt2.c1)
-               ->  Merge Join  (cost=xxx rows=1000 width=8)
-                     Merge Cond: (bmt1.c1 = bmt3.c1)
-                     ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
-               ->  Sort  (cost=xxx rows=100 width=4)
-                     Sort Key: bmt2.c1
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-               Index Cond: (c1 = bmt3.c1)
-(14 rows)
-
-                                       QUERY PLAN                                        
------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=70 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-   ->  Sort  (cost=xxx rows=100 width=12)
-         Sort Key: bmt2.c1
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt2.c1)
-               ->  Hash Join  (cost=xxx rows=1100 width=8)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1100 width=4)
-                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=4)
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-(14 rows)
-
diff --git a/expected/R_2-5-2.out b/expected/R_2-5-2.out
deleted file mode 100644 (file)
index 1481d5d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-                                           QUERY PLAN                                           
-------------------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=100 width=4)
-   Join Filter: (bmt1.c1 = bmt4.c1)
-   ->  Merge Join  (cost=xxx rows=100 width=12)
-         Merge Cond: (bmt1.c1 = bmt2.c1)
-         ->  Merge Join  (cost=xxx rows=1000 width=8)
-               Merge Cond: (bmt1.c1 = bmt3.c1)
-               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
-         ->  Sort  (cost=xxx rows=100 width=4)
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-         Index Cond: (c1 = bmt3.c1)
-(13 rows)
-
-                                       QUERY PLAN                                        
------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=60 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-   ->  Sort  (cost=xxx rows=60 width=12)
-         Sort Key: bmt2.c1
-         ->  Hash Join  (cost=xxx rows=60 width=12)
-               Hash Cond: (bmt3.c1 = bmt2.c1)
-               ->  Hash Join  (cost=xxx rows=660 width=8)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1100 width=4)
-                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=4)
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-(14 rows)
-
diff --git a/expected/R_2-5-3.out b/expected/R_2-5-3.out
deleted file mode 100644 (file)
index 8e34184..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-                                           QUERY PLAN                                           
-------------------------------------------------------------------------------------------------
- Nested Loop  (cost=xxx rows=100 width=4)
-   Join Filter: (bmt1.c1 = bmt4.c1)
-   ->  Merge Join  (cost=xxx rows=100 width=12)
-         Merge Cond: (bmt1.c1 = bmt2.c1)
-         ->  Merge Join  (cost=xxx rows=1000 width=8)
-               Merge Cond: (bmt1.c1 = bmt3.c1)
-               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=4)
-         ->  Sort  (cost=xxx rows=100 width=4)
-               Sort Key: bmt2.c1
-               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=4)
-         Index Cond: (c1 = bmt3.c1)
-(13 rows)
-
-                                       QUERY PLAN                                        
------------------------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=50 width=4)
-   Merge Cond: (bmt1.c1 = bmt2.c1)
-   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=4)
-   ->  Sort  (cost=xxx rows=100 width=12)
-         Sort Key: bmt2.c1
-         ->  Hash Join  (cost=xxx rows=100 width=12)
-               Hash Cond: (bmt3.c1 = bmt2.c1)
-               ->  Hash Join  (cost=xxx rows=1100 width=8)
-                     Hash Cond: (bmt3.c1 = bmt4.c1)
-                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=4)
-                     ->  Hash  (cost=xxx rows=1100 width=4)
-                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=4)
-               ->  Hash  (cost=xxx rows=100 width=4)
-                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=4)
-(14 rows)
-
diff --git a/expected/R_3-1-1.out b/expected/R_3-1-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-1-2.out b/expected/R_3-1-2.out
deleted file mode 100644 (file)
index 3171e12..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=5 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-2-1.out b/expected/R_3-2-1.out
deleted file mode 100644 (file)
index b66bba7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=101 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-2-2.out b/expected/R_3-2-2.out
deleted file mode 100644 (file)
index 0f4733d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=99 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-2-3.out b/expected/R_3-2-3.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-3-1.out b/expected/R_3-3-1.out
deleted file mode 100644 (file)
index 36073c1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-3-2.out b/expected/R_3-3-2.out
deleted file mode 100644 (file)
index 1a52d8d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=200 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-3-3.out b/expected/R_3-3-3.out
deleted file mode 100644 (file)
index 616f070..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=10 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-4-1.out b/expected/R_3-4-1.out
deleted file mode 100644 (file)
index dee42fe..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-                               QUERY PLAN                                
--------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=301 width=31)
-   Hash Cond: (p2.c1 = p1.c1)
-   ->  Append  (cost=xxx rows=304 width=16)
-         ->  Seq Scan on p2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=14)
-         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=15)
-         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=16)
-(19 rows)
-
-                               QUERY PLAN                                
--------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=1 width=31)
-   Hash Cond: (p2.c1 = p1.c1)
-   ->  Append  (cost=xxx rows=304 width=16)
-         ->  Seq Scan on p2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=14)
-         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=15)
-         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=16)
-(19 rows)
-
diff --git a/expected/R_3-4-2.out b/expected/R_3-4-2.out
deleted file mode 100644 (file)
index 506b7dc..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-                               QUERY PLAN                                
--------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=301 width=31)
-   Hash Cond: (p2.c1 = p1.c1)
-   ->  Append  (cost=xxx rows=304 width=16)
-         ->  Seq Scan on p2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=14)
-         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=15)
-         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=16)
-(19 rows)
-
-                               QUERY PLAN                                
--------------------------------------------------------------------------
- Hash Join  (cost=xxx rows=301 width=31)
-   Hash Cond: (p2.c1 = p1.c1)
-   ->  Append  (cost=xxx rows=304 width=16)
-         ->  Seq Scan on p2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=44)
-         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=14)
-         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=15)
-         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=16)
-         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=16)
-   ->  Hash  (cost=xxx rows=301 width=15)
-         ->  Append  (cost=xxx rows=301 width=15)
-               ->  Seq Scan on p1  (cost=xxx rows=1 width=44)
-               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=14)
-               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=16)
-               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=16)
-(19 rows)
-
diff --git a/expected/R_3-5-1.out b/expected/R_3-5-1.out
deleted file mode 100644 (file)
index 866ba43..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-5-2.out b/expected/R_3-5-2.out
deleted file mode 100644 (file)
index 866ba43..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-5-3.out b/expected/R_3-5-3.out
deleted file mode 100644 (file)
index 866ba43..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-5-4.out b/expected/R_3-5-4.out
deleted file mode 100644 (file)
index 866ba43..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=1 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
diff --git a/expected/R_3-6-1.out b/expected/R_3-6-1.out
deleted file mode 100644 (file)
index e65de22..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=100 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
-                                QUERY PLAN                                 
----------------------------------------------------------------------------
- Merge Join  (cost=xxx rows=101 width=29)
-   Merge Cond: (t1.c1 = t2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=15)
-   ->  Sort  (cost=xxx rows=100 width=14)
-         Sort Key: t2.c1
-         ->  Seq Scan on t2  (cost=xxx rows=100 width=14)
-(6 rows)
-
index 73b4923..e37574d 100644 (file)
@@ -143,6 +143,11 @@ CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id =
  * The following GUC parameters need the setting of the default value to
  * succeed in regression test.
  */
+/* Fix auto-tunable parameters */
+ALTER SYSTEM SET effective_cache_size TO 16384;
+\! pg_ctl reload
+server signaled
+SET effective_cache_size TO 16384;
 CREATE VIEW settings AS
 SELECT name, setting, category
   FROM pg_settings
@@ -184,3 +189,4 @@ SELECT * FROM settings;
  client_min_messages       | notice    | Reporting and Logging / When to Log
 (30 rows)
 
+ANALYZE;
index 083c680..0ecce2c 100644 (file)
@@ -1,4 +1,5 @@
 SET search_path TO public;
+SET client_min_messages TO log;
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
               QUERY PLAN              
 --------------------------------------
@@ -20,7 +21,6 @@ EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
 
 LOAD 'pg_hint_plan';
 SET pg_hint_plan.debug_print TO on;
-SET client_min_messages TO LOG;
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
               QUERY PLAN              
 --------------------------------------
@@ -223,7 +223,7 @@ error hint:
 /*+Set(work_mem "1M")*/
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
 INFO:  invalid value for parameter "work_mem": "1M"
-HINT:  Valid units for this parameter are "kB", "MB", and "GB".
+HINT:  Valid units for this parameter are "kB", "MB", "GB", and "TB".
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -6417,13 +6417,11 @@ EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid =
          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c1
          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(11 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(9 rows)
 
 /*+IndexScan(p2 p2_pkey)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6542,22 +6540,17 @@ EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c3
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c4
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-(24 rows)
+   ->  Seq Scan on p2_c4
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+(19 rows)
 
 /*+IndexScan(p2 p2_val)*/
 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
@@ -6588,22 +6581,17 @@ error hint:
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c3
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c4
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-(24 rows)
+   ->  Seq Scan on p2_c4
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+(19 rows)
 
 /*+IndexScan(p2 p2_pkey)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6658,8 +6646,8 @@ not used hint:
 duplication hint:
 error hint:
 
-                   QUERY PLAN                    
--------------------------------------------------
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
  Append
    ->  Index Scan using p2_id2_val on p2
          Index Cond: ((id >= 50) AND (id <= 51))
@@ -6667,13 +6655,11 @@ error hint:
    ->  Index Scan using p2_c1_id2_val on p2_c1
          Index Cond: ((id >= 50) AND (id <= 51))
          Filter: (ctid = '(1,1)'::tid)
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(13 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(11 rows)
 
 /*+IndexScan(p2 p2_val2_id)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6701,13 +6687,11 @@ error hint:
          Filter: (ctid = '(1,1)'::tid)
    ->  Seq Scan on p2_c1
          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(12 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(10 rows)
 
 /*+IndexScan(p2 p2_pkey)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6770,13 +6754,11 @@ error hint:
    ->  Index Scan using p2_c1_id_val_idx on p2_c1
          Index Cond: ((id >= 50) AND (id <= 51))
          Filter: (ctid = '(1,1)'::tid)
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(12 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(10 rows)
 
 /*+IndexScan(p2 no_exist)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6803,13 +6785,11 @@ error hint:
          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c1
          Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(11 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(9 rows)
 
 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -6907,13 +6887,11 @@ error hint:
    ->  Index Scan using p2_c1_id_val_idx on p2_c1
          Index Cond: ((id >= 50) AND (id <= 51))
          Filter: (ctid = '(1,1)'::tid)
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((id >= 50) AND (id <= 51))
-(12 rows)
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((id >= 50) AND (id <= 51) AND (ctid = '(1,1)'::tid))
+(10 rows)
 
 /*+IndexScan(p2 p2_pkey p2_c1_id_val_idx no_exist)*/
 EXPLAIN (COSTS false) SELECT * FROM p2 WHERE id >= 50 AND id <= 51 AND p2.ctid = '(1,1)';
@@ -7029,22 +7007,17 @@ error hint:
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c3
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c4
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-(24 rows)
+   ->  Seq Scan on p2_c4
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+(19 rows)
 
 /*+IndexScan(p2 p2_val_idx6)*/
 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
@@ -7075,22 +7048,17 @@ error hint:
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
    ->  Seq Scan on p2_c3
          Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
-   ->  Tid Scan on p2_c4
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c1_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c1
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-   ->  Tid Scan on p2_c3_c2
-         TID Cond: (ctid = '(1,1)'::tid)
-         Filter: ((val >= '50'::text) AND (val <= '51'::text))
-(24 rows)
+   ->  Seq Scan on p2_c4
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c1_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c1
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+   ->  Seq Scan on p2_c3_c2
+         Filter: ((val >= '50'::text) AND (val <= '51'::text) AND (ctid = '(1,1)'::tid))
+(19 rows)
 
 /*+IndexScan(p2 p2_val_idx p2_val_idx6)*/
 EXPLAIN (COSTS false) SELECT val FROM p2 WHERE val >= '50' AND val <= '51' AND p2.ctid = '(1,1)';
@@ -7996,16 +7964,23 @@ DROP EXTENSION pg_hint_plan;
 --
 -- Rows hint tests
 --
+-- Explain result includes "Planning time" if COSTS is enabled, but
+-- this test needs it enabled for get rows count. So do tests via psql
+-- and grep -v the mutable line.
 -- value types
+\o results/pg_hint_plan.tmpout
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=1000 width=16)
+ Merge Join  (cost=xxx rows=1000 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8015,14 +7990,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=99 width=16)
+ Merge Join  (cost=xxx rows=99 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 +99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8032,14 +8010,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=1099 width=16)
+ Merge Join  (cost=xxx rows=1099 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 -99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8049,14 +8030,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=901 width=16)
+ Merge Join  (cost=xxx rows=901 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 *99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8066,14 +8050,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=99000 width=16)
+ Merge Join  (cost=xxx rows=99000 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 *0.01) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8083,16 +8070,19 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=10 width=16)
+ Merge Join  (cost=xxx rows=10 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #aa) */
-EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);    -- ERROR
+EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
 INFO:  hint syntax error at or near "aa"
 DETAIL:  Rows hint requires valid number as rows estimation.
 LOG:  pg_hint_plan:
@@ -8102,16 +8092,19 @@ duplication hint:
 error hint:
 Rows(t1 t2 #aa)
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=1000 width=16)
+ Merge Join  (cost=xxx rows=1000 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 /99) */
-EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);    -- ERROR
+EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
 INFO:  hint syntax error at or near "/99"
 DETAIL:  Unrecognized rows value type notation.
 LOG:  pg_hint_plan:
@@ -8121,15 +8114,18 @@ duplication hint:
 error hint:
 Rows(t1 t2 /99)
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=1000 width=16)
+ Merge Join  (cost=xxx rows=1000 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
 -- round up to 1
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 -99999) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -99999) 
@@ -8140,29 +8136,35 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                   QUERY PLAN                                  
 ------------------------------------------------------------------------------
- Merge Join  (cost=0.56..90.36 rows=1 width=16)
+ Merge Join  (cost=xxx rows=1 width=xxx)
    Merge Cond: (t1.id = t2.id)
-   ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-   ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-(4 rows)
+   ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+   ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+(5 rows)
 
 -- complex join tree
+\o results/pg_hint_plan.tmpout
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                      QUERY PLAN                                     
 ------------------------------------------------------------------------------------
- Merge Join  (cost=5.88..7.40 rows=10 width=24)
+ Merge Join  (cost=xxx rows=10 width=xxx)
    Merge Cond: (t1.id = t3.id)
-   ->  Merge Join  (cost=0.56..90.36 rows=1000 width=16)
+   ->  Merge Join  (cost=xxx rows=1000 width=xxx)
          Merge Cond: (t1.id = t2.id)
-         ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-         ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-   ->  Sort  (cost=5.32..5.57 rows=100 width=8)
+         ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+         ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
          Sort Key: t3.id
-         ->  Seq Scan on t3  (cost=0.00..2.00 rows=100 width=8)
-(9 rows)
+         ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
+(10 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #22) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8172,19 +8174,22 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                      QUERY PLAN                                     
 ------------------------------------------------------------------------------------
- Merge Join  (cost=5.88..10.48 rows=1 width=24)
+ Merge Join  (cost=xxx rows=1 width=xxx)
    Merge Cond: (t1.id = t3.id)
-   ->  Merge Join  (cost=0.56..90.36 rows=22 width=16)
+   ->  Merge Join  (cost=xxx rows=22 width=xxx)
          Merge Cond: (t1.id = t2.id)
-         ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-         ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-   ->  Sort  (cost=5.32..5.57 rows=100 width=8)
+         ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+         ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
          Sort Key: t3.id
-         ->  Seq Scan on t3  (cost=0.00..2.00 rows=100 width=8)
-(9 rows)
+         ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
+(10 rows)
 
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t3 *10) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
 LOG:  pg_hint_plan:
@@ -8194,16 +8199,19 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
                                      QUERY PLAN                                     
 ------------------------------------------------------------------------------------
- Merge Join  (cost=5.88..7.40 rows=100 width=24)
+ Merge Join  (cost=xxx rows=100 width=xxx)
    Merge Cond: (t1.id = t3.id)
-   ->  Merge Join  (cost=0.56..90.36 rows=1000 width=16)
+   ->  Merge Join  (cost=xxx rows=1000 width=xxx)
          Merge Cond: (t1.id = t2.id)
-         ->  Index Scan using t1_pkey on t1  (cost=0.29..318.29 rows=10000 width=8)
-         ->  Index Scan using t2_pkey on t2  (cost=0.28..43.27 rows=1000 width=8)
-   ->  Sort  (cost=5.32..5.57 rows=100 width=8)
+         ->  Index Scan using t1_pkey on t1  (cost=xxx rows=10000 width=xxx)
+         ->  Index Scan using t2_pkey on t2  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
          Sort Key: t3.id
-         ->  Seq Scan on t3  (cost=0.00..2.00 rows=100 width=8)
-(9 rows)
+         ->  Seq Scan on t3  (cost=xxx rows=100 width=xxx)
+(10 rows)
 
+\! rm results/pg_hint_plan.tmpout
index 9e7fceb..6047e01 100644 (file)
@@ -1612,136 +1612,50 @@ DETAIL:  Nested block comments are not supported.
 ----
 ---- No. A-8-1 original GUC parameter
 ----
+---- Don't test postgresql itself.
 -- No. A-8-1-1
-SET ROLE super_user;
-SET pg_hint_plan.debug_print TO off;
-SHOW pg_hint_plan.enable_hint;
- pg_hint_plan.enable_hint 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- info
-(1 row)
-
-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_hint;
- pg_hint_plan.enable_hint 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- error
-(1 row)
-
-RESET pg_hint_plan.enable_hint;
-RESET pg_hint_plan.debug_print;
-RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable_hint;
- pg_hint_plan.enable_hint 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- info
-(1 row)
-
--- No. A-8-1-2
-SET ROLE normal_user;
-SHOW pg_hint_plan.enable_hint;
- pg_hint_plan.enable_hint 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- info
-(1 row)
-
-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_hint;
- pg_hint_plan.enable_hint 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- error
-(1 row)
-
-RESET pg_hint_plan.enable_hint;
-RESET pg_hint_plan.debug_print;
-RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable_hint;
- pg_hint_plan.enable_hint 
---------------------------
- on
-(1 row)
-
-SHOW pg_hint_plan.debug_print;
- pg_hint_plan.debug_print 
---------------------------
- off
-(1 row)
-
-SHOW pg_hint_plan.parse_messages;
- pg_hint_plan.parse_messages 
------------------------------
- info
-(1 row)
-
-RESET ROLE;
+-- SET ROLE super_user;
+-- SET pg_hint_plan.debug_print TO off;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 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_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- RESET pg_hint_plan.enable_hint;
+-- RESET pg_hint_plan.debug_print;
+-- RESET pg_hint_plan.parse_messages;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 
+-- -- No. A-8-1-2
+-- SET ROLE normal_user;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 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_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- RESET pg_hint_plan.enable_hint;
+-- RESET pg_hint_plan.debug_print;
+-- RESET pg_hint_plan.parse_messages;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 
+-- RESET ROLE;
 ----
 ---- No. A-8-2 original GUC parameter pg_hint_plan.enable_hint
 ----
 -- No. A-8-2-1
+SET pg_hint_plan.debug_print TO off;
 SET pg_hint_plan.enable_hint TO on;
 SHOW pg_hint_plan.enable_hint;
  pg_hint_plan.enable_hint 
@@ -1776,36 +1690,26 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 (2 rows)
 
 -- 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            
-----------------------------------
- Bitmap Heap Scan on t1
-   Recheck Cond: (c1 = 1)
-   ->  Bitmap Index Scan on t1_i1
-         Index Cond: (c1 = 1)
-(4 rows)
-
+-- Don't test PostgreSQL itself.
+-- SET pg_hint_plan.enable_hint TO DEFAULT;
+-- SHOW pg_hint_plan.enable_hint;
+-- /*+Set(enable_indexscan off)*/
+-- EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 -- No. A-8-2-4
-SET pg_hint_plan.enable_hint TO enable;
-ERROR:  parameter "pg_hint_plan.enable_hint" requires a Boolean value
+-- Don't test PostgreSQL itself
+-- SET pg_hint_plan.enable_hint TO enable;
+-- SHOW pg_hint_plan.enable_hint;
+----
+---- No. A-8-3 original GUC parameter pg_hint_plan.debug_print
+----
+-- No. A-8-3-1
+SET pg_hint_plan.enable_hint TO on;
 SHOW pg_hint_plan.enable_hint;
  pg_hint_plan.enable_hint 
 --------------------------
  on
 (1 row)
 
-----
----- No. A-8-3 original GUC parameter pg_hint_plan.debug_print
-----
--- No. A-8-3-1
 SET pg_hint_plan.debug_print TO on;
 SHOW pg_hint_plan.debug_print;
  pg_hint_plan.debug_print 
index 0647d1f..9141990 100644 (file)
@@ -782,6 +782,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 =
          Filter: (c1 = $0)
 (13 rows)
 
+\o results/ut-J.tmpout
 /*+MergeJoin(t1 t2)NestLoop(st1 st2)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
 LOG:  pg_hint_plan:
@@ -792,20 +793,22 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-J.tmpout
                                          QUERY PLAN                                          
 ---------------------------------------------------------------------------------------------
- Nested Loop  (cost=10000000077.03..10000000087.31 rows=1 width=29)
+ Nested Loop  (cost=xxx rows=1 width=xxx)
    InitPlan 1 (returns $1)
-     ->  Aggregate  (cost=76.75..76.76 rows=1 width=4)
-           ->  Nested Loop  (cost=0.28..76.50 rows=100 width=4)
-                 ->  Seq Scan on t2 st2  (cost=0.00..2.00 rows=100 width=4)
-                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=0.28..0.74 rows=1 width=4)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1 width=xxx)
                        Index Cond: (c1 = st2.c1)
-   ->  Index Scan using t1_i1 on t1  (cost=0.28..8.29 rows=1 width=15)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
          Index Cond: (c1 = $1)
-   ->  Seq Scan on t2  (cost=0.00..2.25 rows=1 width=14)
+   ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
          Filter: (c1 = $1)
-(11 rows)
+(12 rows)
 
 --
 -- There are cases where difference in the measured value and predicted value
@@ -4642,6 +4645,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c
          ->  Seq Scan on t2
 (5 rows)
 
+\o results/ut-J.tmpout
 /*+NestLoop(t1 t2)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
 LOG:  pg_hint_plan:
@@ -4651,12 +4655,15 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-J.tmpout
                                 QUERY PLAN                                
 --------------------------------------------------------------------------
- Hash Full Join  (cost=10000000003.25..10000000024.00 rows=1000 width=29)
+ Hash Full Join  (cost=xxx rows=1000 width=xxx)
    Hash Cond: (t1.c1 = t2.c1)
-   ->  Seq Scan on t1  (cost=0.00..16.00 rows=1000 width=15)
-   ->  Hash  (cost=2.00..2.00 rows=100 width=14)
-         ->  Seq Scan on t2  (cost=0.00..2.00 rows=100 width=14)
-(5 rows)
+   ->  Seq Scan on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=100 width=xxx)
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(6 rows)
 
+\! rm results/ut-J.tmpout
index 1ee094f..38d8c46 100644 (file)
@@ -3,16 +3,25 @@ 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;
-\o results/R_sample.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_sample.out.log > results/R_sample.out
-\! diff expected/R_sample.out results/R_sample.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-1-1 specified pattern of the object name
 ----
 -- No. R-1-1-1
-\o results/R_1-1-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -23,10 +32,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-1.out.log > results/R_1-1-1.out
-\! diff expected/R_1-1-1.out results/R_1-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-1-2
-\o results/R_1-1-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
 LOG:  pg_hint_plan:
@@ -37,10 +55,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-2.out.log > results/R_1-1-2.out
-\! diff expected/R_1-1-2.out results/R_1-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                   
+-------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-1-3
-\o results/R_1-1-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t_1 t_2 #1)*/
 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
 LOG:  pg_hint_plan:
@@ -51,13 +78,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-3.out.log > results/R_1-1-3.out
-\! diff expected/R_1-1-3.out results/R_1-1-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                   
+-------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t_1.c1 = t_2.c1)
+   ->  Index Scan using t1_i1 on t1 t_1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t_2.c1
+         ->  Seq Scan on t2 t_2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-1-2 specified schema name in the hint option
 ----
 -- No. R-1-2-1
-\o results/R_1-2-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -68,10 +104,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-2-1.out.log > results/R_1-2-1.out
-\! diff expected/R_1-2-1.out results/R_1-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-2-2
-\o results/R_1-2-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(s1.t1 s1.t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -82,13 +127,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-2-2.out.log > results/R_1-2-2.out
-\! diff expected/R_1-2-2.out results/R_1-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-1-3 table doesn't exist in the hint option
 ----
 -- No. R-1-3-1
-\o results/R_1-3-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -99,10 +153,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-3-1.out.log > results/R_1-3-1.out
-\! diff expected/R_1-3-1.out results/R_1-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-3-2
-\o results/R_1-3-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t3 t4 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -113,13 +176,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-3-2.out.log > results/R_1-3-2.out
-\! diff expected/R_1-3-2.out results/R_1-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-1-4 conflict table name
 ----
 -- No. R-1-4-1
-\o results/R_1-4-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -130,11 +202,33 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-1.out.log > results/R_1-4-1.out
-\! diff expected/R_1-4-1.out results/R_1-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-4-2
-\o results/R_1-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t1_1.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
 INFO:  hint syntax error at or near "Rows(t1 t1 #1)"
@@ -146,6 +240,19 @@ duplication hint:
 error hint:
 Rows(t1 t1 #1)
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t1_1.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(s1.t1 s2.t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
 LOG:  pg_hint_plan:
@@ -155,7 +262,33 @@ Rows(s1.t1 s2.t1 #1)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t1_1.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t1_1.c1
+         ->  Seq Scan on t1 t1_1  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = s2t1.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: s2t1.c1
+         ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 s2t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
 LOG:  pg_hint_plan:
@@ -166,11 +299,41 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-2.out.log > results/R_1-4-2.out
-\! diff expected/R_1-4-2.out results/R_1-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = s2t1.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: s2t1.c1
+         ->  Seq Scan on t1 s2t1  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-4-3
-\o results/R_1-4-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                            QUERY PLAN                                            
+--------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   InitPlan 1 (returns $0)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                 Merge Cond: (t1_1.c1 = t2_1.c1)
+                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                       Sort Key: t2_1.c1
+                       ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -180,6 +343,27 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                            QUERY PLAN                                            
+--------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   InitPlan 1 (returns $0)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                 Merge Cond: (t1_1.c1 = t2_1.c1)
+                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                       Sort Key: t2_1.c1
+                       ->  Seq Scan on t2 t2_1  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(st1 st2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -191,13 +375,30 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-3.out.log > results/R_1-4-3.out
-\! diff expected/R_1-4-3.out results/R_1-4-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                           QUERY PLAN                                            
+-------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   InitPlan 1 (returns $0)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                 Merge Cond: (st1.c1 = st2.c1)
+                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                       Sort Key: st2.c1
+                       ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
 ----
 ---- No. R-1-5 conflict table name
 ----
 -- No. R-1-5-1
-\o results/R_1-5-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -208,10 +409,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-1.out.log > results/R_1-5-1.out
-\! diff expected/R_1-5-1.out results/R_1-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-5-2
-\o results/R_1-5-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "Rows(t1 t1 #1)"
@@ -224,27 +434,81 @@ error hint:
 Rows(t1 t1 #1)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-2.out.log > results/R_1-5-2.out
-\! diff expected/R_1-5-2.out results/R_1-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-5-3
-\o results/R_1-5-3.out.log
+\o results/ut-R.tmpout
 /*+(t1 t1)(t2 t2)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "(t1 t1)(t2 t2)"
 DETAIL:  Unrecognized hint keyword "".
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+         Merge Cond: (t1.c1 = t3.c1)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+         ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1100 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(10 rows)
+
+\o results/ut-R.tmpout
 /*+(t1 t2 t1 t2)*/
 EXPLAIN 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 "(t1 t2 t1 t2)"
 DETAIL:  Unrecognized hint keyword "".
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-3.out.log > results/R_1-5-3.out
-\! diff expected/R_1-5-3.out results/R_1-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                      QUERY PLAN                                       
+---------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=100 width=xxx)
+   Join Filter: (t1.c1 = t4.c1)
+   ->  Merge Join  (cost=xxx rows=100 width=xxx)
+         Merge Cond: (t1.c1 = t2.c1)
+         ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+               Merge Cond: (t1.c1 = t3.c1)
+               ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+               ->  Index Scan using t3_i1 on t3  (cost=xxx rows=1100 width=xxx)
+         ->  Sort  (cost=xxx rows=100 width=xxx)
+               Sort Key: t2.c1
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t4_i1 on t4  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = t3.c1)
+(14 rows)
+
 ----
 ---- No. R-1-6 object type for the hint
 ----
 -- No. R-1-6-1
-\o results/R_1-6-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -255,11 +519,40 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-1.out.log > results/R_1-6-1.out
-\! diff expected/R_1-6-1.out results/R_1-6-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-6-2
-\o results/R_1-6-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                  
+------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=301 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Append  (cost=xxx rows=301 width=xxx)
+         ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=xxx)
+         ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=xxx)
+         ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=xxx)
+(14 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -270,11 +563,39 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-2.out.log > results/R_1-6-2.out
-\! diff expected/R_1-6-2.out results/R_1-6-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                  
+------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Append  (cost=xxx rows=301 width=xxx)
+         ->  Seq Scan on p1 t1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p1c1 t1_1  (cost=xxx rows=100 width=xxx)
+         ->  Seq Scan on p1c2 t1_2  (cost=xxx rows=100 width=xxx)
+         ->  Seq Scan on p1c3 t1_3  (cost=xxx rows=100 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1 t2  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1 t2_1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2 t2_2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3 t2_3  (cost=xxx rows=100 width=xxx)
+(14 rows)
+
 -- No. R-1-6-3
-\o results/R_1-6-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1100 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Seq Scan on ul1 t1  (cost=xxx rows=1100 width=xxx)
+   ->  Hash  (cost=xxx rows=1100 width=xxx)
+         ->  Seq Scan on ul1 t2  (cost=xxx rows=1100 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -285,12 +606,32 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-3.out.log > results/R_1-6-3.out
-\! diff expected/R_1-6-3.out results/R_1-6-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Seq Scan on ul1 t1  (cost=xxx rows=1100 width=xxx)
+   ->  Hash  (cost=xxx rows=1100 width=xxx)
+         ->  Seq Scan on ul1 t2  (cost=xxx rows=1100 width=xxx)
+(6 rows)
+
 -- No. R-1-6-4
 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
-\o results/R_1-6-4.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1100 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Seq Scan on tm1 t1  (cost=xxx rows=1100 width=xxx)
+   ->  Hash  (cost=xxx rows=1100 width=xxx)
+         ->  Seq Scan on tm1 t2  (cost=xxx rows=1100 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -301,13 +642,34 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-4.out.log > results/R_1-6-4.out
-\! diff expected/R_1-6-4.out results/R_1-6-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+                              QUERY PLAN                               
+-----------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (t1.c1 = t2.c1)
+   ->  Seq Scan on tm1 t1  (cost=xxx rows=1100 width=xxx)
+   ->  Hash  (cost=xxx rows=1100 width=xxx)
+         ->  Seq Scan on tm1 t2  (cost=xxx rows=1100 width=xxx)
+(6 rows)
+
 -- No. R-1-6-5
-\o results/R_1-6-5.out.log
-EXPLAIN SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+CREATE TEMP TABLE t_pg_class WITH OIDS AS SELECT * from pg_class LIMIT 100;
+\o results/ut-R.tmpout
+EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                  
+------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=360 width=xxx)
+   Hash Cond: (t1.oid = t2.oid)
+   ->  Seq Scan on t_pg_class t1  (cost=xxx rows=360 width=xxx)
+   ->  Hash  (cost=xxx rows=360 width=xxx)
+         ->  Seq Scan on t_pg_class t2  (cost=xxx rows=360 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
-EXPLAIN SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
 LOG:  pg_hint_plan:
 used hint:
 Rows(t1 t2 #1)
@@ -316,13 +678,32 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-5.out.log > results/R_1-6-5.out
-\! diff expected/R_1-6-5.out results/R_1-6-5.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                  QUERY PLAN                                  
+------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (t1.oid = t2.oid)
+   ->  Seq Scan on t_pg_class t1  (cost=xxx rows=360 width=xxx)
+   ->  Hash  (cost=xxx rows=360 width=xxx)
+         ->  Seq Scan on t_pg_class t2  (cost=xxx rows=360 width=xxx)
+(6 rows)
+
 -- No. R-1-6-6
 -- refer ut-fdw.sql
 -- No. R-1-6-7
-\o results/R_1-6-7.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                           QUERY PLAN                            
+-----------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   Join Filter: (t1.c1 = t2.c1)
+   ->  Function Scan on f1 t1  (cost=xxx rows=1 width=xxx)
+   ->  Function Scan on f1 t2  (cost=xxx rows=1 width=xxx)
+(5 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -333,11 +714,30 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-7.out.log > results/R_1-6-7.out
-\! diff expected/R_1-6-7.out results/R_1-6-7.out
+\! sql/maskout.sh results/ut-R.tmpout
+                           QUERY PLAN                            
+-----------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   Join Filter: (t1.c1 = t2.c1)
+   ->  Function Scan on f1 t1  (cost=xxx rows=1 width=xxx)
+   ->  Function Scan on f1 t2  (cost=xxx rows=1 width=xxx)
+(5 rows)
+
 -- No. R-1-6-8
-\o results/R_1-6-8.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=3 width=xxx)
+   Hash Cond: (t2.c1 = "*VALUES*".column1)
+   ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  Hash  (cost=xxx rows=3 width=xxx)
+         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -347,6 +747,18 @@ Rows(t1 t2 #1)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=3 width=xxx)
+   Hash Cond: (t2.c1 = "*VALUES*".column1)
+   ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  Hash  (cost=xxx rows=3 width=xxx)
+         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(*VALUES* t2 #1)*/
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -357,11 +769,38 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-8.out.log > results/R_1-6-8.out
-\! diff expected/R_1-6-8.out results/R_1-6-8.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (t2.c1 = "*VALUES*".column1)
+   ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  Hash  (cost=xxx rows=3 width=xxx)
+         ->  Values Scan on "*VALUES*"  (cost=xxx rows=3 width=xxx)
+(6 rows)
+
 -- No. R-1-6-9
-\o results/R_1-6-9.out.log
+\o results/ut-R.tmpout
 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                            QUERY PLAN                                            
+--------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                 Merge Cond: (t1_1.c1 = t2.c1)
+                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                       Sort Key: t2.c1
+                       ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = c1.c1)
+(13 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 c1 +1)*/
 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
 LOG:  pg_hint_plan:
@@ -373,11 +812,38 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-9.out.log > results/R_1-6-9.out
-\! diff expected/R_1-6-9.out results/R_1-6-9.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                            QUERY PLAN                                            
+--------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=2 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                 Merge Cond: (t1_1.c1 = t2.c1)
+                 ->  Index Only Scan using t1_i1 on t1 t1_1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                       Sort Key: t2.c1
+                       ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = c1.c1)
+(13 rows)
+
 -- No. R-1-6-10
-\o results/R_1-6-10.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -387,6 +853,18 @@ Rows(t1 t2 #1)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(v1t1 v1t1_ #1)*/
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -397,27 +875,39 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-10.out.log > results/R_1-6-10.out
-\! diff expected/R_1-6-10.out results/R_1-6-10.out
+\! sql/maskout.sh results/ut-R.tmpout
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (v1t1.c1 = v1t1_.c1)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 v1t1_  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
 -- No. R-1-6-11
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
                                            QUERY PLAN                                            
 -------------------------------------------------------------------------------------------------
- Nested Loop  (cost=12.28..22.56 rows=1 width=29)
+ Nested Loop  (cost=xxx rows=1 width=xxx)
    InitPlan 1 (returns $0)
-     ->  Aggregate  (cost=12.00..12.01 rows=1 width=4)
-           ->  Merge Join  (cost=5.60..11.75 rows=100 width=4)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=100 width=xxx)
                  Merge Cond: (st1.c1 = st2.c1)
-                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=0.28..44.27 rows=1000 width=4)
-                 ->  Sort  (cost=5.32..5.57 rows=100 width=4)
+                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
                        Sort Key: st2.c1
-                       ->  Seq Scan on t2 st2  (cost=0.00..2.00 rows=100 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=0.28..8.29 rows=1 width=15)
+                       ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
          Index Cond: (c1 = $0)
-   ->  Seq Scan on t2  (cost=0.00..2.25 rows=1 width=14)
+   ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
          Filter: (c1 = $0)
-(13 rows)
+(14 rows)
 
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(st1 st2 #1)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
 LOG:  pg_hint_plan:
@@ -428,29 +918,44 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
                                            QUERY PLAN                                            
 -------------------------------------------------------------------------------------------------
- Nested Loop  (cost=12.03..22.31 rows=1 width=29)
+ Nested Loop  (cost=xxx rows=1 width=xxx)
    InitPlan 1 (returns $0)
-     ->  Aggregate  (cost=11.75..11.76 rows=1 width=4)
-           ->  Merge Join  (cost=5.60..11.75 rows=1 width=4)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Merge Join  (cost=xxx rows=1 width=xxx)
                  Merge Cond: (st1.c1 = st2.c1)
-                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=0.28..44.27 rows=1000 width=4)
-                 ->  Sort  (cost=5.32..5.57 rows=100 width=4)
+                 ->  Index Only Scan using t1_i1 on t1 st1  (cost=xxx rows=1000 width=xxx)
+                 ->  Sort  (cost=xxx rows=100 width=xxx)
                        Sort Key: st2.c1
-                       ->  Seq Scan on t2 st2  (cost=0.00..2.00 rows=100 width=4)
-   ->  Index Scan using t1_i1 on t1  (cost=0.28..8.29 rows=1 width=15)
+                       ->  Seq Scan on t2 st2  (cost=xxx rows=100 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
          Index Cond: (c1 = $0)
-   ->  Seq Scan on t2  (cost=0.00..2.25 rows=1 width=14)
+   ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
          Filter: (c1 = $0)
-(13 rows)
+(14 rows)
 
 --
 -- There are cases where difference in the measured value and predicted value
 -- depending upon the version of PostgreSQL
 --
-\o results/R_1-6-11.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 st2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
 LOG:  pg_hint_plan:
@@ -460,6 +965,19 @@ Rows(st2 t1 #1)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
 LOG:  pg_hint_plan:
@@ -470,13 +988,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-11.out.log > results/R_1-6-11.out
-\! diff expected/R_1-6-11.out results/R_1-6-11.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-1-7 specified number of conditions
 ----
 -- No. R-1-7-1
-\o results/R_1-7-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near ""
@@ -489,10 +1016,19 @@ error hint:
 Rows(t1 #1)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-1.out.log > results/R_1-7-1.out
-\! diff expected/R_1-7-1.out results/R_1-7-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-7-2
-\o results/R_1-7-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "1"
@@ -505,10 +1041,19 @@ error hint:
 Rows(t1 t2 1)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-2.out.log > results/R_1-7-2.out
-\! diff expected/R_1-7-2.out results/R_1-7-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-1-7-3
-\o results/R_1-7-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #notrows)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "notrows"
@@ -521,13 +1066,22 @@ error hint:
 Rows(t1 t2 #notrows)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-3.out.log > results/R_1-7-3.out
-\! diff expected/R_1-7-3.out results/R_1-7-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-2-1 some complexity query blocks
 ----
 -- No. R-2-1-1
-\o results/R_2-1-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -562,6 +1116,57 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(45 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -608,10 +1213,57 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-1.out.log > results/R_2-1-1.out
-\! diff expected/R_2-1-1.out results/R_2-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(45 rows)
+
 -- No. R-2-1-2
-\o results/R_2-1-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -654,6 +1306,71 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   InitPlan 3 (returns $5)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(59 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -713,10 +1430,71 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-2.out.log > results/R_2-1-2.out
-\! diff expected/R_2-1-2.out results/R_2-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   InitPlan 3 (returns $5)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(59 rows)
+
 -- No. R-2-1-3
-\o results/R_2-1-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 */
@@ -728,6 +1506,28 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                          QUERY PLAN                                           
+-----------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Merge Join  (cost=xxx rows=100 width=xxx)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+         ->  Sort  (cost=xxx rows=100 width=xxx)
+               Sort Key: bmt2.c1
+               ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt2.c1)
+                     ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                           Hash Cond: (bmt3.c1 = bmt4.c1)
+                           ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                           ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                 ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=100 width=xxx)
+                           ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+(16 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
@@ -744,10 +1544,26 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-3.out.log > results/R_2-1-3.out
-\! diff expected/R_2-1-3.out results/R_2-1-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                         QUERY PLAN                                         
+--------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt2.c1 = bmt1.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1100 width=xxx)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(14 rows)
+
 -- No. R-2-1-4
-\o results/R_2-1-4.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 */
@@ -759,6 +1575,28 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                          QUERY PLAN                                           
+-----------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Merge Join  (cost=xxx rows=100 width=xxx)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+         ->  Sort  (cost=xxx rows=100 width=xxx)
+               Sort Key: bmt2.c1
+               ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt2.c1)
+                     ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                           Hash Cond: (bmt3.c1 = bmt4.c1)
+                           ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                           ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                 ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=100 width=xxx)
+                           ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+(16 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
@@ -775,10 +1613,26 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-4.out.log > results/R_2-1-4.out
-\! diff expected/R_2-1-4.out results/R_2-1-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                         QUERY PLAN                                         
+--------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt2.c1 = bmt1.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1100 width=xxx)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+         ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(14 rows)
+
 -- No. R-2-1-5
-\o results/R_2-1-5.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -793,8 +1647,7 @@ AND bmt1.c1 <> (
 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
 ) AND bmt1.c1 <> (
 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t2 b1t3)
@@ -813,6 +1666,58 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=xxx)
+                                 Filter: ((c1 <> $1) AND (c1 <> $3))
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(46 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -860,10 +1765,58 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-5.out.log > results/R_2-1-5.out
-\! diff expected/R_2-1-5.out results/R_2-1-5.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=998 width=xxx)
+                                 Filter: ((c1 <> $1) AND (c1 <> $3))
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(46 rows)
+
 -- No. R-2-1-6
-\o results/R_2-1-6.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -906,6 +1859,72 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   InitPlan 3 (returns $5)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=xxx)
+                                 Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(60 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -965,10 +1984,72 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-6.out.log > results/R_2-1-6.out
-\! diff expected/R_2-1-6.out results/R_2-1-6.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   InitPlan 1 (returns $1)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   InitPlan 3 (returns $5)
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=997 width=xxx)
+                                 Filter: ((c1 <> $1) AND (c1 <> $3) AND (c1 <> $5))
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(60 rows)
+
 -- No. R-2-1-7
-\o results/R_2-1-7.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -1010,6 +2091,67 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   CTE c2
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Hash Join  (cost=xxx rows=1 width=xxx)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+         ->  Hash  (cost=xxx rows=1 width=xxx)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (bmt3.c1 = bmt1.c1)
+                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: bmt1.c1
+                           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                                       Hash Cond: (bmt1.c1 = c1.c1)
+                                       ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                                   Merge Cond: (c1.c1 = c2.c1)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c1.c1
+                                                         ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c2.c1
+                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
+                                 ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                                       Index Cond: (c1 = bmt1.c1)
+(55 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -1032,8 +2174,7 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
 , c1, c2
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
-AND bmt1.c1 = c2.c1
-;
+AND bmt1.c1 = c2.c1;
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t2 b1t3)
@@ -1066,10 +2207,67 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-7.out.log > results/R_2-1-7.out
-\! diff expected/R_2-1-7.out results/R_2-1-7.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   CTE c2
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   ->  Hash Join  (cost=xxx rows=1 width=xxx)
+         Hash Cond: (bmt4.c1 = bmt1.c1)
+         ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+         ->  Hash  (cost=xxx rows=1 width=xxx)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (bmt3.c1 = bmt1.c1)
+                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: bmt1.c1
+                           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                                       Hash Cond: (bmt1.c1 = c1.c1)
+                                       ->  Seq Scan on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                                   Merge Cond: (c1.c1 = c2.c1)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c1.c1
+                                                         ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c2.c1
+                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
+                                 ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                                       Index Cond: (c1 = bmt1.c1)
+(55 rows)
+
 -- No. R-2-1-8
-\o results/R_2-1-8.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -1095,8 +2293,7 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 = c2.c1
-AND bmt1.c1 = c3.c1
-;
+AND bmt1.c1 = c3.c1;
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t2 b1t3)
@@ -1122,6 +2319,87 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   CTE c2
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1000 width=xxx)
+                       Hash Cond: (b2t3.c1 = b2t1.c1)
+                       ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                             Merge Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1000 width=xxx)
+                             ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   CTE c3
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Sort  (cost=xxx rows=1 width=xxx)
+                                 Sort Key: bmt1.c1
+                                 ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                                       ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                                             Hash Cond: (c2.c1 = c1.c1)
+                                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                                   Merge Cond: (c2.c1 = c3.c1)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c2.c1
+                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c3.c1
+                                                         ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
+                                             ->  Hash  (cost=xxx rows=1 width=xxx)
+                                                   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+                                       ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+                                             Index Cond: (c1 = c1.c1)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(75 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -1151,8 +2429,7 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 = c2.c1
-AND bmt1.c1 = c3.c1
-;
+AND bmt1.c1 = c3.c1;
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t2 b1t3)
@@ -1194,13 +2471,90 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-8.out.log > results/R_2-1-8.out
-\! diff expected/R_2-1-8.out results/R_2-1-8.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                     QUERY PLAN                                                     
+--------------------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b1t2.c1 = b1t1.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b1t4.c1 = b1t2.c1)
+                       ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b1t3.c1 = b1t2.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Sort  (cost=xxx rows=100 width=xxx)
+                                         Sort Key: b1t2.c1
+                                         ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b1t3.c1)
+   CTE c2
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b2t1.c1 = b2t3.c1)
+                       ->  Seq Scan on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+                       ->  Hash  (cost=xxx rows=1 width=xxx)
+                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                   Merge Cond: (b2t3.c1 = b2t4.c1)
+                                   ->  Index Only Scan using t3_i1 on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                                   ->  Index Only Scan using t4_i1 on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b2t1.c1)
+   CTE c3
+     ->  Aggregate  (cost=xxx rows=1 width=xxx)
+           ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                 Join Filter: (b3t1.c1 = b3t3.c1)
+                 ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                       Hash Cond: (b3t1.c1 = b3t2.c1)
+                       ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                             Merge Cond: (b3t1.c1 = b3t4.c1)
+                             ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+                             ->  Index Only Scan using t4_i1 on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Hash  (cost=xxx rows=100 width=xxx)
+                             ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+                 ->  Index Only Scan using t3_i1 on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                       Index Cond: (c1 = b3t4.c1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt1.c1)
+               ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                           Merge Cond: (bmt1.c1 = bmt2.c1)
+                           ->  Sort  (cost=xxx rows=1 width=xxx)
+                                 Sort Key: bmt1.c1
+                                 ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                                       ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                                             Hash Cond: (c2.c1 = c1.c1)
+                                             ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                                   Merge Cond: (c2.c1 = c3.c1)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c2.c1
+                                                         ->  CTE Scan on c2  (cost=xxx rows=1 width=xxx)
+                                                   ->  Sort  (cost=xxx rows=1 width=xxx)
+                                                         Sort Key: c3.c1
+                                                         ->  CTE Scan on c3  (cost=xxx rows=1 width=xxx)
+                                             ->  Hash  (cost=xxx rows=1 width=xxx)
+                                                   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+                                       ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+                                             Index Cond: (c1 = c1.c1)
+                           ->  Sort  (cost=xxx rows=100 width=xxx)
+                                 Sort Key: bmt2.c1
+                                 ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(75 rows)
+
 ----
 ---- No. R-2-2 the number of the tables per quiry block
 ----
 -- No. R-2-2-1
-\o results/R_2-2-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt1)
 */
@@ -1215,8 +2569,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 Leading(c1 bmt1)
@@ -1224,6 +2577,28 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                    QUERY PLAN                                    
+----------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 2 (returns $1)
+     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 3 (returns $2)
+     ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = 1)
+         Filter: (c1 <> $2)
+   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+         Filter: (c1 = 1)
+(16 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt1)
 Rows(bmt1 c1 #1)
@@ -1242,8 +2617,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 Leading(c1 bmt1)
@@ -1256,10 +2630,28 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-1.out.log > results/R_2-2-1.out
-\! diff expected/R_2-2-1.out results/R_2-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                    QUERY PLAN                                    
+----------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   CTE c1
+     ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 2 (returns $1)
+     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 3 (returns $2)
+     ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = 1)
+         Filter: (c1 <> $2)
+   ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+         Filter: (c1 = 1)
+(16 rows)
+
 -- No. R-2-2-2
-\o results/R_2-2-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt2 bmt1)
 Leading(b1t2 b1t1)
@@ -1282,8 +2674,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t1 b1t2)
@@ -1299,6 +2690,47 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                         QUERY PLAN                                         
+--------------------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=10 width=xxx)
+   Hash Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b1t2.c1
+                 ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+   InitPlan 2 (returns $1)
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b2t2.c1
+                 ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
+   InitPlan 3 (returns $2)
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b3t1.c1 = b3t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b3t2.c1
+                 ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+   ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $2)
+   ->  Hash  (cost=xxx rows=100 width=xxx)
+         ->  Merge Join  (cost=xxx rows=100 width=xxx)
+               Merge Cond: (bmt2.c1 = c1.c1)
+               ->  Sort  (cost=xxx rows=100 width=xxx)
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+               ->  Sort  (cost=xxx rows=100 width=xxx)
+                     Sort Key: c1.c1
+                     ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
+(35 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt2 bmt1)
 Leading(b1t2 b1t1)
@@ -1349,10 +2781,47 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-2.out.log > results/R_2-2-2.out
-\! diff expected/R_2-2-2.out results/R_2-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                         QUERY PLAN                                         
+--------------------------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b1t2.c1
+                 ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+   InitPlan 2 (returns $1)
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b2t2.c1
+                 ->  Seq Scan on t2 b2t2  (cost=xxx rows=100 width=xxx)
+   InitPlan 3 (returns $2)
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b3t1.c1 = b3t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b3t2.c1
+                 ->  Seq Scan on t2 b3t2  (cost=xxx rows=100 width=xxx)
+   ->  Seq Scan on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $2)
+   ->  Hash  (cost=xxx rows=1 width=xxx)
+         ->  Merge Join  (cost=xxx rows=1 width=xxx)
+               Merge Cond: (bmt2.c1 = c1.c1)
+               ->  Sort  (cost=xxx rows=100 width=xxx)
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+               ->  Sort  (cost=xxx rows=1 width=xxx)
+                     Sort Key: c1.c1
+                     ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+(35 rows)
+
 -- No. R-2-2-3
-\o results/R_2-2-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1) 
@@ -1382,8 +2851,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(b1t3 b1t4)
@@ -1407,6 +2875,74 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                    QUERY PLAN                                                    
+------------------------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=10 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b1t2.c1
+                 ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                             Hash Cond: (b1t3.c1 = b1t4.c1)
+                             ->  Seq Scan on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b2t2.c1
+                 ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                             Hash Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Seq Scan on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b2t3.c1)
+   InitPlan 3 (returns $5)
+     ->  Merge Join  (cost=xxx rows=100 width=xxx)
+           Merge Cond: (b3t1.c1 = b3t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=100 width=xxx)
+                 Sort Key: b3t2.c1
+                 ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                             Hash Cond: (b3t3.c1 = b3t4.c1)
+                             ->  Seq Scan on t3 b3t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b3t3.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $5)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+               ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=100 width=xxx)
+                           ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                 Merge Cond: (bmt4.c1 = c1.c1)
+                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                                       Sort Key: c1.c1
+                                       ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+(62 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1) 
@@ -1449,8 +2985,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(b1t3 b1t4)
@@ -1488,10 +3023,74 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-3.out.log > results/R_2-2-3.out
-\! diff expected/R_2-2-3.out results/R_2-2-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                    QUERY PLAN                                                    
+------------------------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b1t1.c1 = b1t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=1 width=xxx)
+                 Sort Key: b1t2.c1
+                 ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                             Hash Cond: (b1t3.c1 = b1t4.c1)
+                             ->  Seq Scan on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $3)
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b2t1.c1 = b2t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=1 width=xxx)
+                 Sort Key: b2t2.c1
+                 ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                             Hash Cond: (b2t3.c1 = b2t4.c1)
+                             ->  Seq Scan on t3 b2t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b2t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b2t3.c1)
+   InitPlan 3 (returns $5)
+     ->  Merge Join  (cost=xxx rows=1 width=xxx)
+           Merge Cond: (b3t1.c1 = b3t2.c1)
+           ->  Index Only Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+           ->  Sort  (cost=xxx rows=1 width=xxx)
+                 Sort Key: b3t2.c1
+                 ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+                       ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                             Hash Cond: (b3t3.c1 = b3t4.c1)
+                             ->  Seq Scan on t3 b3t3  (cost=xxx rows=1100 width=xxx)
+                             ->  Hash  (cost=xxx rows=1100 width=xxx)
+                                   ->  Seq Scan on t4 b3t4  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t2_i1 on t2 b3t2  (cost=xxx rows=1 width=xxx)
+                             Index Cond: (c1 = b3t3.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $5)
+   ->  Sort  (cost=xxx rows=1 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1 width=xxx)
+                           ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                 Merge Cond: (bmt4.c1 = c1.c1)
+                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                                 ->  Sort  (cost=xxx rows=1 width=xxx)
+                                       Sort Key: c1.c1
+                                       ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+(62 rows)
+
 -- No. R-2-2-4
-\o results/R_2-2-4.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1)
@@ -1513,8 +3112,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t3 b1t4)
@@ -1530,6 +3128,50 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                                    QUERY PLAN                                                    
+------------------------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=10 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+           Join Filter: (b1t2.c1 = b1t1.c1)
+           ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                 Hash Cond: (b1t3.c1 = b1t2.c1)
+                 ->  Merge Join  (cost=xxx rows=1100 width=xxx)
+                       Merge Cond: (b1t3.c1 = b1t4.c1)
+                       ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Hash  (cost=xxx rows=100 width=xxx)
+                       ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                 Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $2)
+     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 3 (returns $3)
+     ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $3)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+               ->  Hash Join  (cost=xxx rows=100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=100 width=xxx)
+                           ->  Merge Join  (cost=xxx rows=100 width=xxx)
+                                 Merge Cond: (bmt4.c1 = c1.c1)
+                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                                 ->  Sort  (cost=xxx rows=100 width=xxx)
+                                       Sort Key: c1.c1
+                                       ->  CTE Scan on c1  (cost=xxx rows=100 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+(38 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1)
@@ -1558,8 +3200,7 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1
-)
-;
+);
 LOG:  pg_hint_plan:
 used hint:
 MergeJoin(b1t3 b1t4)
@@ -1583,13 +3224,53 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-4.out.log > results/R_2-2-4.out
-\! diff expected/R_2-2-4.out results/R_2-2-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                                    QUERY PLAN                                                    
+------------------------------------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   CTE c1
+     ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+           Join Filter: (b1t2.c1 = b1t1.c1)
+           ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                 Hash Cond: (b1t3.c1 = b1t2.c1)
+                 ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                       Merge Cond: (b1t3.c1 = b1t4.c1)
+                       ->  Index Only Scan using t3_i1 on t3 b1t3  (cost=xxx rows=1100 width=xxx)
+                       ->  Index Only Scan using t4_i1 on t4 b1t4  (cost=xxx rows=1100 width=xxx)
+                 ->  Hash  (cost=xxx rows=100 width=xxx)
+                       ->  Seq Scan on t2 b1t2  (cost=xxx rows=100 width=xxx)
+           ->  Index Only Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                 Index Cond: (c1 = b1t3.c1)
+   InitPlan 2 (returns $2)
+     ->  Index Only Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+           Index Cond: (c1 = 1)
+   InitPlan 3 (returns $3)
+     ->  Seq Scan on t1 b3t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=999 width=xxx)
+         Filter: (c1 <> $3)
+   ->  Sort  (cost=xxx rows=1 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               ->  Hash Join  (cost=xxx rows=1 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1 width=xxx)
+                           ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                                 Merge Cond: (bmt4.c1 = c1.c1)
+                                 ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+                                 ->  Sort  (cost=xxx rows=1 width=xxx)
+                                       Sort Key: c1.c1
+                                       ->  CTE Scan on c1  (cost=xxx rows=1 width=xxx)
+               ->  Index Only Scan using t2_i1 on t2 bmt2  (cost=xxx rows=1 width=xxx)
+                     Index Cond: (c1 = bmt3.c1)
+(38 rows)
+
 ----
 ---- No. R-2-3 RULE or VIEW
 ----
 -- No. R-2-3-1
-\o results/R_2-3-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r1 t1 t2 t3 t4)
 */
@@ -1601,6 +3282,33 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                          QUERY PLAN                                           
+-----------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r1  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(21 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1 t1 t2 t3 t4)
 Rows(r1 t1 t2 t3 t4 #2)
@@ -1620,6 +3328,31 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r1  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(19 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
 */
@@ -1631,6 +3364,33 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                             QUERY PLAN                                             
+----------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b1t1.c1 = b1t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r1_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b1t2.c1
+                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(21 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
 Rows(r1_ b1t1 b1t2 b1t3 b1t4 #2)
@@ -1651,10 +3411,31 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-1.out.log > results/R_2-3-1.out
-\! diff expected/R_2-3-1.out results/R_2-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                     QUERY PLAN                                      
+-------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b1t1.c1 = b1t2.c1)
+                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r1_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(19 rows)
+
 -- No. R-2-3-2
-\o results/R_2-3-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r2 t1 t2 t3 t4)
 */
@@ -1673,6 +3454,54 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                          QUERY PLAN                                           
+-----------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(43 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2 t1 t2 t3 t4)
 Rows(r2 t1 t2 t3 t4 #2)
@@ -1703,6 +3532,50 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(39 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
@@ -1724,6 +3597,54 @@ Leading(r2_ b1t1 b1t2 b1t3 b1t4)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                             QUERY PLAN                                             
+----------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b1t1.c1 = b1t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b1t2.c1
+                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b2t1.c1 = b2t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b2t1.c1 = b2t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b2t1.c1 = b2t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b2t2.c1
+                           ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(43 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
@@ -1770,10 +3691,50 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-2.out.log > results/R_2-3-2.out
-\! diff expected/R_2-3-2.out results/R_2-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                     QUERY PLAN                                      
+-------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b1t1.c1 = b1t2.c1)
+                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b2t1.c1 = b2t4.c1)
+         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b2t1.c1 = b2t3.c1)
+               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b2t1.c1 = b2t2.c1)
+                     ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r2_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(39 rows)
+
 -- No. R-2-3-3
-\o results/R_2-3-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r3 t1 t2 t3 t4)
 */
@@ -1799,6 +3760,75 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                          QUERY PLAN                                           
+-----------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (t1.c1 = t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: t2.c1
+                           ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(65 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3 t1 t2 t3 t4)
 Rows(r3 t1 t2 t3 t4 #2)
@@ -1840,6 +3870,69 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                    
+---------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (t1.c1 = t4.c1)
+         ->  Tid Scan on t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (t1.c1 = t3.c1)
+               ->  Tid Scan on t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (t1.c1 = t2.c1)
+                     ->  Seq Scan on t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(59 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
@@ -1873,6 +3966,75 @@ Leading(r3_ b2t1 b2t2 b2t3 b2t4)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                             QUERY PLAN                                             
+----------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b1t1.c1 = b1t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b1t2.c1
+                           ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b2t1.c1 = b2t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b2t1.c1 = b2t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b2t1.c1 = b2t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b2t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b2t2.c1
+                           ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (b3t1.c1 = b3t4.c1)
+         ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+               Join Filter: (b3t1.c1 = b3t3.c1)
+               ->  Merge Join  (cost=xxx rows=1 width=xxx)
+                     Merge Cond: (b3t1.c1 = b3t2.c1)
+                     ->  Nested Loop  (cost=xxx rows=6 width=xxx)
+                           ->  Index Scan using t1_i1 on t1 b3t1  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+                     ->  Sort  (cost=xxx rows=1 width=xxx)
+                           Sort Key: b3t2.c1
+                           ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
+                                 Filter: (ctid = '(1,1)'::tid)
+               ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+         ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+(65 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
@@ -1955,10 +4117,69 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-3.out.log > results/R_2-3-3.out
-\! diff expected/R_2-3-3.out results/R_2-3-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                     QUERY PLAN                                      
+-------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b1t1.c1 = b1t4.c1)
+         ->  Tid Scan on t4 b1t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b1t1.c1 = b1t3.c1)
+               ->  Tid Scan on t3 b1t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b1t1.c1 = b1t2.c1)
+                     ->  Seq Scan on t2 b1t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b1t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b2t1.c1 = b2t4.c1)
+         ->  Tid Scan on t4 b2t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b2t1.c1 = b2t3.c1)
+               ->  Tid Scan on t3 b2t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b2t1.c1 = b2t2.c1)
+                     ->  Seq Scan on t2 b2t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b2t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         Join Filter: (b3t1.c1 = b3t4.c1)
+         ->  Tid Scan on t4 b3t4  (cost=xxx rows=1 width=xxx)
+               TID Cond: (ctid = '(1,1)'::tid)
+         ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+               Join Filter: (b3t1.c1 = b3t3.c1)
+               ->  Tid Scan on t3 b3t3  (cost=xxx rows=1 width=xxx)
+                     TID Cond: (ctid = '(1,1)'::tid)
+               ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                     Join Filter: (b3t1.c1 = b3t2.c1)
+                     ->  Seq Scan on t2 b3t2  (cost=xxx rows=1 width=xxx)
+                           Filter: (ctid = '(1,1)'::tid)
+                     ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+                           ->  Tid Scan on t1 b3t1  (cost=xxx rows=1 width=xxx)
+                                 TID Cond: (ctid = '(1,1)'::tid)
+                           ->  Seq Scan on r3_  (cost=xxx rows=6 width=xxx)
+                                 Filter: (c1 = 1)
+(59 rows)
+
 -- No. R-2-3-4
-\o results/R_2-3-4.out.log
+\o results/ut-R.tmpout
 /*+HashJoin(v1t1 v1t1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
 INFO:  hint syntax error at or near "HashJoin(v1t1 v1t1)"
@@ -1970,6 +4191,18 @@ duplication hint:
 error hint:
 HashJoin(v1t1 v1t1)
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
 INFO:  hint syntax error at or near "HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)"
@@ -1985,10 +4218,18 @@ HashJoin(v1t1 v1t1)
 Rows(v1t1 v1t1 #1)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-4.out.log > results/R_2-3-4.out
-\! diff expected/R_2-3-4.out results/R_2-3-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (v1t1.c1 = v1t1_1.c1)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 v1t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
 -- No. R-2-3-5
-\o results/R_2-3-5.out.log
+\o results/ut-R.tmpout
 /*+NestLoop(v1t1 v1t1_)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
 LOG:  pg_hint_plan:
@@ -1998,6 +4239,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                 QUERY PLAN                                  
+-----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1000 width=xxx)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = v1t1.c1)
+(5 rows)
+
+\o results/ut-R.tmpout
 /*+NestLoop(v1t1 v1t1_)Rows(v1t1 v1t1_ #1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
 LOG:  pg_hint_plan:
@@ -2009,23 +4261,50 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-5.out.log > results/R_2-3-5.out
-\! diff expected/R_2-3-5.out results/R_2-3-5.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                 QUERY PLAN                                  
+-----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Seq Scan on t1 v1t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Scan using t1_i1 on t1 v1t1_  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = v1t1.c1)
+(5 rows)
+
 -- No. R-2-3-6
-\o results/R_2-3-6.out.log
+\o results/ut-R.tmpout
 /*+RowsHashJoin(r4t1 r4t1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "RowsHashJoin(r4t1 r4t1)"
 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (r4t1.c1 = r4t1_1.c1)
+   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
+\o results/ut-R.tmpout
 /*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)"
 DETAIL:  Unrecognized hint keyword "RowsHashJoin".
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-6.out.log > results/R_2-3-6.out
-\! diff expected/R_2-3-6.out results/R_2-3-6.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                
+--------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1000 width=xxx)
+   Hash Cond: (r4t1.c1 = r4t1_1.c1)
+   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
+   ->  Hash  (cost=xxx rows=1000 width=xxx)
+         ->  Seq Scan on t1 r4t1_1  (cost=xxx rows=1000 width=xxx)
+(6 rows)
+
 -- No. R-2-3-7
-\o results/R_2-3-7.out.log
+\o results/ut-R.tmpout
 /*+NestLoop(r4t1 r5t1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2035,6 +4314,17 @@ not used hint:
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                 QUERY PLAN                                 
+----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1000 width=xxx)
+   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = r4t1.c1)
+(5 rows)
+
+\o results/ut-R.tmpout
 /*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2046,14 +4336,36 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-7.out.log > results/R_2-3-7.out
-\! diff expected/R_2-3-7.out results/R_2-3-7.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                 QUERY PLAN                                 
+----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Seq Scan on t1 r4t1  (cost=xxx rows=1000 width=xxx)
+   ->  Index Scan using t1_i1 on t1 r5t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = r4t1.c1)
+(5 rows)
+
 ----
 ---- No. R-2-4 VALUES clause
 ----
 -- No. R-2-4-1
-\o results/R_2-4-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                   
+--------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Hash Join  (cost=xxx rows=1 width=xxx)
+         Hash Cond: (t2.c1 = "*VALUES*".column1)
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+         ->  Hash  (cost=xxx rows=1 width=xxx)
+               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = t2.c1)
+(9 rows)
+
+\o results/ut-R.tmpout
 /*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
 EXPLAIN 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;
 LOG:  pg_hint_plan:
@@ -2065,6 +4377,21 @@ Rows(t1 t2 t3 #2)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                   QUERY PLAN                                   
+--------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Hash Join  (cost=xxx rows=1 width=xxx)
+         Hash Cond: (t2.c1 = "*VALUES*".column1)
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+         ->  Hash  (cost=xxx rows=1 width=xxx)
+               ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = t2.c1)
+(9 rows)
+
+\o results/ut-R.tmpout
 /*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #2)*/
 EXPLAIN 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;
 LOG:  pg_hint_plan:
@@ -2077,11 +4404,39 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-1.out.log > results/R_2-4-1.out
-\! diff expected/R_2-4-1.out results/R_2-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                 QUERY PLAN                                  
+-----------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=2 width=xxx)
+         ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = "*VALUES*".column1)
+   ->  Index Scan using t2_i1 on t2  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = t1.c1)
+(8 rows)
+
 -- No. R-2-4-2
-\o results/R_2-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
+(12 rows)
+
+\o results/ut-R.tmpout
 /*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
 EXPLAIN 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;
 LOG:  pg_hint_plan:
@@ -2094,6 +4449,24 @@ Rows(t1 t2 t3 t4 #2)
 duplication hint:
 error hint:
 
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
+(12 rows)
+
+\o results/ut-R.tmpout
 /*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
 EXPLAIN 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 "Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)"
@@ -2113,14 +4486,49 @@ Rows(*VALUES* t2 t3 #2)
 Rows(*VALUES* t1 t2 t3 #2)
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-2.out.log > results/R_2-4-2.out
-\! diff expected/R_2-4-2.out results/R_2-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                      QUERY PLAN                                      
+--------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   Join Filter: (t1.c1 = "*VALUES*_1".column1)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         ->  Hash Join  (cost=xxx rows=1 width=xxx)
+               Hash Cond: (t2.c1 = "*VALUES*".column1)
+               ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+               ->  Hash  (cost=xxx rows=1 width=xxx)
+                     ->  Values Scan on "*VALUES*"  (cost=xxx rows=1 width=xxx)
+         ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = t2.c1)
+   ->  Values Scan on "*VALUES*_1"  (cost=xxx rows=2 width=xxx)
+(12 rows)
+
 ----
 ---- No. R-2-5
 ----
 -- No. R-2-5-1
-\o results/R_2-5-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                              QUERY PLAN                                              
+------------------------------------------------------------------------------------------------------
+ Aggregate  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=100 width=xxx)
+         Join Filter: (bmt1.c1 = bmt4.c1)
+         ->  Merge Join  (cost=xxx rows=100 width=xxx)
+               Merge Cond: (bmt1.c1 = bmt2.c1)
+               ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+                     Merge Cond: (bmt1.c1 = bmt3.c1)
+                     ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+                     ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+               ->  Sort  (cost=xxx rows=100 width=xxx)
+                     Sort Key: bmt2.c1
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+         ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+               Index Cond: (c1 = bmt3.c1)
+(15 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
@@ -2135,11 +4543,48 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-1.out.log > results/R_2-5-1.out
-\! diff expected/R_2-5-1.out results/R_2-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=70 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1100 width=xxx)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
 -- No. R-2-5-2
-\o results/R_2-5-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                           QUERY PLAN                                           
+------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=100 width=xxx)
+   Join Filter: (bmt1.c1 = bmt4.c1)
+   ->  Merge Join  (cost=xxx rows=100 width=xxx)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+               Merge Cond: (bmt1.c1 = bmt3.c1)
+               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+         ->  Sort  (cost=xxx rows=100 width=xxx)
+               Sort Key: bmt2.c1
+               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = bmt3.c1)
+(14 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 *0.6)
@@ -2154,11 +4599,48 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-2.out.log > results/R_2-5-2.out
-\! diff expected/R_2-5-2.out results/R_2-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=60 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=60 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=60 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=660 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1100 width=xxx)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
 -- No. R-2-5-3
-\o results/R_2-5-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                           QUERY PLAN                                           
+------------------------------------------------------------------------------------------------
+ Nested Loop  (cost=xxx rows=100 width=xxx)
+   Join Filter: (bmt1.c1 = bmt4.c1)
+   ->  Merge Join  (cost=xxx rows=100 width=xxx)
+         Merge Cond: (bmt1.c1 = bmt2.c1)
+         ->  Merge Join  (cost=xxx rows=1000 width=xxx)
+               Merge Cond: (bmt1.c1 = bmt3.c1)
+               ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+               ->  Index Only Scan using t3_i1 on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+         ->  Sort  (cost=xxx rows=100 width=xxx)
+               Sort Key: bmt2.c1
+               ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+   ->  Index Only Scan using t4_i1 on t4 bmt4  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = bmt3.c1)
+(14 rows)
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt1 *0.5)
@@ -2173,13 +4655,30 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-3.out.log > results/R_2-5-3.out
-\! diff expected/R_2-5-3.out results/R_2-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                       QUERY PLAN                                        
+-----------------------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=50 width=xxx)
+   Merge Cond: (bmt1.c1 = bmt2.c1)
+   ->  Index Only Scan using t1_i1 on t1 bmt1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: bmt2.c1
+         ->  Hash Join  (cost=xxx rows=100 width=xxx)
+               Hash Cond: (bmt3.c1 = bmt2.c1)
+               ->  Hash Join  (cost=xxx rows=1100 width=xxx)
+                     Hash Cond: (bmt3.c1 = bmt4.c1)
+                     ->  Seq Scan on t3 bmt3  (cost=xxx rows=1100 width=xxx)
+                     ->  Hash  (cost=xxx rows=1100 width=xxx)
+                           ->  Seq Scan on t4 bmt4  (cost=xxx rows=1100 width=xxx)
+               ->  Hash  (cost=xxx rows=100 width=xxx)
+                     ->  Seq Scan on t2 bmt2  (cost=xxx rows=100 width=xxx)
+(15 rows)
+
 ----
 ---- No. R-3-1 abusolute value
 ----
 -- No. R-3-1-1
-\o results/R_3-1-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #0)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 #0)
@@ -2191,10 +4690,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-1-1.out.log > results/R_3-1-1.out
-\! diff expected/R_3-1-1.out results/R_3-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-1-2
-\o results/R_3-1-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #5)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2205,13 +4713,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-1-2.out.log > results/R_3-1-2.out
-\! diff expected/R_3-1-2.out results/R_3-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=5 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-3-2 increase or decrease value
 ----
 -- No. R-3-2-1
-\o results/R_3-2-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 +1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2222,10 +4739,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-1.out.log > results/R_3-2-1.out
-\! diff expected/R_3-2-1.out results/R_3-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=101 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-2-2
-\o results/R_3-2-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 -1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2236,10 +4762,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-2.out.log > results/R_3-2-2.out
-\! diff expected/R_3-2-2.out results/R_3-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=99 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-2-3
-\o results/R_3-2-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 -1000)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 -1000)
@@ -2251,13 +4786,22 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-3.out.log > results/R_3-2-3.out
-\! diff expected/R_3-2-3.out results/R_3-2-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-3-3 multiple 
 ----
 -- No. R-3-3-1
-\o results/R_3-3-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *0)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 WARNING:  Force estimate to be at least one row, to avoid possible divide-by-zero when interpolating costs : Rows(t1 t2 *0)
@@ -2269,10 +4813,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-1.out.log > results/R_3-3-1.out
-\! diff expected/R_3-3-1.out results/R_3-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-3-2
-\o results/R_3-3-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *2)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2283,10 +4836,19 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-2.out.log > results/R_3-3-2.out
-\! diff expected/R_3-3-2.out results/R_3-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=200 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-3-3
-\o results/R_3-3-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *0.1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 LOG:  pg_hint_plan:
@@ -2297,14 +4859,49 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-3.out.log > results/R_3-3-3.out
-\! diff expected/R_3-3-3.out results/R_3-3-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=10 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-3-4 join inherit tables
 ----
 -- No. R-3-4-1
-\o results/R_3-4-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=301 width=xxx)
+   Hash Cond: (p2.c1 = p1.c1)
+   ->  Append  (cost=xxx rows=304 width=xxx)
+         ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
+(20 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(p1 p2 #1)*/
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
 LOG:  pg_hint_plan:
@@ -2315,11 +4912,59 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-4-1.out.log > results/R_3-4-1.out
-\! diff expected/R_3-4-1.out results/R_3-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=1 width=xxx)
+   Hash Cond: (p2.c1 = p1.c1)
+   ->  Append  (cost=xxx rows=304 width=xxx)
+         ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
+(20 rows)
+
 -- No. R-3-4-2
-\o results/R_3-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=301 width=xxx)
+   Hash Cond: (p2.c1 = p1.c1)
+   ->  Append  (cost=xxx rows=304 width=xxx)
+         ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
+(20 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(p1c1 p2c1 #1)*/
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
 LOG:  pg_hint_plan:
@@ -2330,14 +4975,49 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-4-2.out.log > results/R_3-4-2.out
-\! diff expected/R_3-4-2.out results/R_3-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                               QUERY PLAN                                
+-------------------------------------------------------------------------
+ Hash Join  (cost=xxx rows=301 width=xxx)
+   Hash Cond: (p2.c1 = p1.c1)
+   ->  Append  (cost=xxx rows=304 width=xxx)
+         ->  Seq Scan on p2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c2  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c3  (cost=xxx rows=1 width=xxx)
+         ->  Seq Scan on p2c1c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c1c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c2c2  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c1  (cost=xxx rows=50 width=xxx)
+         ->  Seq Scan on p2c3c2  (cost=xxx rows=50 width=xxx)
+   ->  Hash  (cost=xxx rows=301 width=xxx)
+         ->  Append  (cost=xxx rows=301 width=xxx)
+               ->  Seq Scan on p1  (cost=xxx rows=1 width=xxx)
+               ->  Seq Scan on p1c1  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c2  (cost=xxx rows=100 width=xxx)
+               ->  Seq Scan on p1c3  (cost=xxx rows=100 width=xxx)
+(20 rows)
+
 ----
 ---- No. R-3-5 conflict join method hint
 ----
 -- No. R-3-5-1
-\o results/R_3-5-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)"
@@ -2351,11 +5031,33 @@ Rows(t1 t2 #1)
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-1.out.log > results/R_3-5-1.out
-\! diff expected/R_3-5-1.out results/R_3-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-5-2
-\o results/R_3-5-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)"
@@ -2372,11 +5074,33 @@ Rows(t1 t2 #1)
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-2.out.log > results/R_3-5-2.out
-\! diff expected/R_3-5-2.out results/R_3-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-5-3
-\o results/R_3-5-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t2 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "Rows(t1 t2 #1)Rows(t2 t1 #1)"
@@ -2390,11 +5114,33 @@ Rows(t1 t2 #1)
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-3.out.log > results/R_3-5-3.out
-\! diff expected/R_3-5-3.out results/R_3-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 -- No. R-3-5-4
-\o results/R_3-5-4.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 INFO:  hint syntax error at or near "Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)"
@@ -2411,15 +5157,37 @@ Rows(t1 t2 #1)
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-4.out.log > results/R_3-5-4.out
-\! diff expected/R_3-5-4.out results/R_3-5-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=1 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
 ----
 ---- No. R-3-6 hint state output
 ----
 -- No. R-3-6-1
 SET client_min_messages TO DEBUG1;
-\o results/R_3-6-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=100 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 +1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 DEBUG:  adjusted rows 100 to 101
@@ -2431,5 +5199,15 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-6-1.out.log > results/R_3-6-1.out
-\! diff expected/R_3-6-1.out results/R_3-6-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+                                QUERY PLAN                                 
+---------------------------------------------------------------------------
+ Merge Join  (cost=xxx rows=101 width=xxx)
+   Merge Cond: (t1.c1 = t2.c1)
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1000 width=xxx)
+   ->  Sort  (cost=xxx rows=100 width=xxx)
+         Sort Key: t2.c1
+         ->  Seq Scan on t2  (cost=xxx rows=100 width=xxx)
+(7 rows)
+
+\! rm results/ut-R.tmpout
index 0a5cf59..8c19e92 100644 (file)
@@ -1,4 +1,10 @@
 LOAD 'pg_hint_plan';
+-- We cannot do ALTER USER current_user SET ...
+DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user);
+INSERT INTO pg_db_role_setting (SELECT 0, (SELECT oid FROM pg_roles WHERE rolname = current_user), '{client_min_messages=log,pg_hint_plan.debug_print=on}');
+ALTER SYSTEM SET session_preload_libraries TO 'pg_hint_plan';
+\! pg_ctl reload
+server signaled
 SET pg_hint_plan.enable_hint TO on;
 SET pg_hint_plan.debug_print TO on;
 SET client_min_messages TO LOG;
@@ -4483,8 +4489,7 @@ error hint:
 ---- No. S-3-5 not used index
 ----
 -- No. S-3-5-1
-/*+IndexScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for IndexScan(ti1): ti1_pred
 LOG:  pg_hint_plan:
 used hint:
@@ -4497,11 +4502,10 @@ error hint:
 ------------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=15)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-2
-/*+BitmapScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for BitmapScan(ti1): ti1_pred
 LOG:  pg_hint_plan:
 used hint:
@@ -4514,11 +4518,10 @@ error hint:
 ------------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=15)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-3
-/*+IndexOnlyScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for IndexOnlyScan(ti1): ti1_pred
 LOG:  pg_hint_plan:
 used hint:
@@ -4531,11 +4534,10 @@ error hint:
 -----------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=4)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-4
-/*+IndexScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for IndexScan(ti1):
 LOG:  pg_hint_plan:
 used hint:
@@ -4548,11 +4550,10 @@ error hint:
 ------------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=15)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-5
-/*+BitmapScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for BitmapScan(ti1):
 LOG:  pg_hint_plan:
 used hint:
@@ -4565,11 +4566,10 @@ error hint:
 ------------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=15)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-6
-/*+IndexOnlyScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 LOG:  available indexes for IndexOnlyScan(ti1):
 LOG:  pg_hint_plan:
 used hint:
@@ -4582,7 +4582,7 @@ error hint:
 -----------------------------------------------------------------------
  Seq Scan on ti1  (cost=10000000000.00..10000000018.50 rows=1 width=4)
    Filter: (c1 = 100)
-(2 rows)
+(3 rows)
 
 -- No. S-3-5-7
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
@@ -4592,8 +4592,7 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
    Index Cond: (c1 = 1)
 (2 rows)
 
-/*+TidScan(t1)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+\! psql contrib_regression -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
 LOG:  pg_hint_plan:
 used hint:
 TidScan(t1)
@@ -4605,7 +4604,7 @@ error hint:
 -----------------------------------------------------------------------
  Seq Scan on t1  (cost=10000000000.00..10000000018.50 rows=1 width=15)
    Filter: (c1 = 1)
-(2 rows)
+(3 rows)
 
 ----
 ---- No. S-3-6 query structure
@@ -5143,7 +5142,7 @@ error hint:
 (7 rows)
 
 -- No. S-3-10-3
-EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10;
+\! psql contrib_regression -c "EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10" | grep -v "Planning time:"
                         QUERY PLAN                        
 ----------------------------------------------------------
  Append  (cost=0.00..2.75 rows=4 width=10)
@@ -5151,10 +5150,9 @@ EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10;
          Filter: ((c1 < 10) AND ((c2 * 2) < 100))
    ->  Seq Scan on p1c1  (cost=0.00..2.75 rows=3 width=2)
          Filter: ((c1 < 10) AND ((c2 * 2) < 100))
-(5 rows)
+(6 rows)
 
-/*+IndexScan(p1 p1_parent)*/
-EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10;
+\! psql contrib_regression -c "/*+IndexScan(p1 p1_parent)*/ EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10" | grep -v "Planning time:"
 LOG:  available indexes for IndexScan(p1): p1_parent
 LOG:  available indexes for IndexScan(p1c1): p1c1_c4_expr_idx
 LOG:  available indexes for IndexScan(p1c2): p1c2_c4_expr_idx
@@ -5173,11 +5171,10 @@ error hint:
          Filter: ((c2 * 2) < 100)
    ->  Index Scan using p1c1_c4_expr_idx on p1c1  (cost=0.14..12.34 rows=3 width=2)
          Filter: ((c2 * 2) < 100)
-(5 rows)
+(6 rows)
 
 -- No. S-3-10-4
-/*+IndexScan(p1 p1_i2)*/
-EXPLAIN SELECT c2 FROM s1.p1 WHERE c2 = 1;
+\! psql contrib_regression -c "/*+IndexScan(p1 p1_i2)*/ EXPLAIN SELECT c2 FROM s1.p1 WHERE c2 = 1" | grep -v "Planning time:"
 LOG:  available indexes for IndexScan(p1): p1_i2
 LOG:  available indexes for IndexScan(p1c1):
 LOG:  available indexes for IndexScan(p1c2):
@@ -5200,11 +5197,10 @@ error hint:
          Filter: (c2 = 1)
    ->  Seq Scan on p1c3  (cost=10000000000.00..10000000002.25 rows=1 width=4)
          Filter: (c2 = 1)
-(9 rows)
+(10 rows)
 
 -- No. S-3-10-5
-/*+IndexScan(p2 p2c1_pkey)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1;
+\! psql contrib_regression -c "/*+IndexScan(p2 p2c1_pkey)*/ EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1" | grep -v "Planning time:"
 LOG:  available indexes for IndexScan(p2):
 LOG:  available indexes for IndexScan(p2c1): p2c1_pkey
 LOG:  available indexes for IndexScan(p2c2):
@@ -5231,7 +5227,7 @@ error hint:
          Index Cond: (c1 = 1)
    ->  Seq Scan on p2c1c1  (cost=10000000000.00..10000000001.62 rows=1 width=14)
          Filter: (c1 = 1)
-(7 rows)
+(8 rows)
 
 ----
 ---- No. S-3-12 specified same table
@@ -6096,3 +6092,7 @@ error hint:
    Filter: (c2 = 1)
 (2 rows)
 
+DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user);
+ALTER SYSTEM SET session_preload_libraries TO DEFAULT;
+\! pg_ctl reload
+server signaled
index 422ff9f..3523859 100644 (file)
@@ -43,11 +43,9 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1
 ----
 
 -- No. R-1-6-6
-\o results/R_1-6-6.out.log
+\o results/ut-fdw.tmpout
 /*+Rows(ft_1 ft_2 #1)Leading(ft_1 ft_2 t1)*/
 EXPLAIN SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-6.out.log > results/R_1-6-6.out_2.log
-\! sed 's/Foreign File: .*/Foreign File: @pg_hint_plan@\/data\/data.csv/' results/R_1-6-6.out_2.log > results/R_1-6-6.out
-\! diff expected/R_1-6-6.out results/R_1-6-6.out
-
+\! sql/maskout.sh results/ut-fdw.tmpout
+\! rm results/ut-fdw.tmpout
index 247b9b3..4907980 100644 (file)
@@ -116,7 +116,7 @@ error hint:
 ---- No. R-1-6 object type for the hint
 ----
 -- No. R-1-6-6
-\o results/R_1-6-6.out.log
+\o results/ut-fdw.tmpout
 /*+Rows(ft_1 ft_2 #1)Leading(ft_1 ft_2 t1)*/
 EXPLAIN SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
 LOG:  pg_hint_plan:
@@ -128,6 +128,17 @@ duplication hint:
 error hint:
 
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-6.out.log > results/R_1-6-6.out_2.log
-\! sed 's/Foreign File: .*/Foreign File: @pg_hint_plan@\/data\/data.csv/' results/R_1-6-6.out_2.log > results/R_1-6-6.out
-\! diff expected/R_1-6-6.out results/R_1-6-6.out
+\! sql/maskout.sh results/ut-fdw.tmpout
+ Nested Loop  (cost=xxx rows=1 width=xxx)
+   ->  Nested Loop  (cost=xxx rows=1 width=xxx)
+         Join Filter: (ft_1.id = ft_2.id)
+         ->  Foreign Scan on ft1 ft_1  (cost=xxx rows=1 width=xxx)
+               Foreign File: @abs_srcdir@/data/data.csv
+               Foreign File Size: 42
+         ->  Foreign Scan on ft1 ft_2  (cost=xxx rows=1 width=xxx)
+               Foreign File: @abs_srcdir@/data/data.csv
+               Foreign File Size: 42
+   ->  Index Scan using t1_i1 on t1  (cost=xxx rows=1 width=xxx)
+         Index Cond: (c1 = ft_1.id)
+
+\! rm results/ut-fdw.tmpout
index f9aa642..5f869c2 100644 (file)
@@ -4,7 +4,7 @@
  *             Track statement execution times across a whole database cluster.
  *
  * Execution costs are totalled for each distinct source query, and kept in
- * a shared hashtable. (We track only as many distinct queries as will fit
+ * a shared hashtable.  (We track only as many distinct queries as will fit
  * in the designated amount of shared memory.)
  *
  * As of Postgres 9.2, this module normalizes query entries.  Normalization
@@ -15,7 +15,7 @@
  *
  * Normalization is implemented by fingerprinting queries, selectively
  * serializing those fields of each query tree's nodes that are judged to be
- * essential to the query.     This is referred to as a query jumble.  This is
+ * essential to the query.  This is referred to as a query jumble.  This is
  * distinct from a regular serialization in that various extraneous
  * information is ignored as irrelevant or not essential to the query, such
  * as the collations of Vars and, most notably, the values of constants.
  * tree(s) generated from the query.  The executor can then use this value
  * to blame query costs on the proper queryId.
  *
+ * To facilitate presenting entries to users, we create "representative" query
+ * strings in which constants are replaced with '?' characters, to make it
+ * clearer what a normalized entry can represent.  To save on shared memory,
+ * and to avoid having to truncate oversized query strings, we store these
+ * strings in a temporary external query-texts file.  Offsets into this
+ * file are kept in shared memory.
+ *
  * Note about locking issues: to create or delete an entry in the shared
  * hashtable, one must hold pgss->lock exclusively.  Modifying any field
  * in an entry except the counters requires the same.  To look up an entry,
  * one must hold the lock shared.  To read or update the counters within
  * an entry, one must hold the lock shared or exclusive (so the entry doesn't
  * disappear!) and also take the entry's mutex spinlock.
+ * The shared state variable pgss->extent (the next free spot in the external
+ * query-text file) should be accessed only while holding either the
+ * pgss->mutex spinlock, or exclusive lock on pgss->lock.  We use the mutex to
+ * allow reserving file space while holding only shared lock on pgss->lock.
+ * Rewriting the entire external query-text file, eg for garbage collection,
+ * requires holding pgss->lock exclusively; this allows individual entries
+ * in the file to be read or written while holding only shared lock.
  *
  *
  * Copyright (c) 2008-2014, PostgreSQL Global Development Group
  */
 #include "postgres.h"
 
-#ifdef NOT_USED
+#include <sys/stat.h>
 
+#ifdef NOT_USED
 #include <unistd.h>
-
 #endif
+
 #include "access/hash.h"
 #ifdef NOT_USED
 #include "executor/instrument.h"
 #include "storage/spin.h"
 #include "tcop/utility.h"
 #include "utils/builtins.h"
+#include "utils/memutils.h"
 
 
 PG_MODULE_MAGIC;
 
-/* Location of stats file */
-#define PGSS_DUMP_FILE "global/pg_stat_statements.stat"
+/* Location of permanent stats file (valid when database is shut down) */
+#define PGSS_DUMP_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "/pg_stat_statements.stat"
 
-/* This constant defines the magic number in the stats file header */
-static const uint32 PGSS_FILE_HEADER = 0x20120328;
+/*
+ * Location of external query text file.  We don't keep it in the core
+ * system's stats_temp_directory.  The core system can safely use that GUC
+ * setting, because the statistics collector temp file paths are set only once
+ * as part of changing the GUC, but pg_stat_statements has no way of avoiding
+ * race conditions.  Besides, we only expect modest, infrequent I/O for query
+ * strings, so placing the file on a faster filesystem is not compelling.
+ */
+#define PGSS_TEXT_FILE PG_STAT_TMP_DIR "/pgss_query_texts.stat"
+
+/* Magic number identifying the stats file format */
+static const uint32 PGSS_FILE_HEADER = 0x20140125;
+
+/* PostgreSQL major version number, changes in which invalidate all entries */
+static const uint32 PGSS_PG_MAJOR_VERSION = PG_VERSION_NUM / 100;
 
 /* XXX: Should USAGE_EXEC reflect execution time and/or buffer usage? */
 #define USAGE_EXEC(duration)   (1.0)
 #define USAGE_INIT                             (1.0)   /* including initial planning */
 #define ASSUMED_MEDIAN_INIT            (10.0)  /* initial assumed median usage */
+#define ASSUMED_LENGTH_INIT            1024    /* initial assumed mean query length */
 #define USAGE_DECREASE_FACTOR  (0.99)  /* decreased every entry_dealloc */
 #define STICKY_DECREASE_FACTOR (0.50)  /* factor for sticky entries */
 #define USAGE_DEALLOC_PERCENT  5               /* free this % of entries at once */
@@ -86,18 +116,23 @@ static const uint32 PGSS_FILE_HEADER = 0x20120328;
 #define JUMBLE_SIZE                            1024    /* query serialization buffer size */
 
 /*
+ * Extension version number, for supporting older extension versions' objects
+ */
+typedef enum pgssVersion
+{
+       PGSS_V1_0 = 0,
+       PGSS_V1_1,
+       PGSS_V1_2
+} pgssVersion;
+
+/*
  * Hashtable key that defines the identity of a hashtable entry.  We separate
  * queries by user and by database even if they are otherwise identical.
- *
- * Presently, the query encoding is fully determined by the source database
- * and so we don't really need it to be in the key.  But that might not always
- * be true. Anyway it's notationally convenient to pass it as part of the key.
  */
 typedef struct pgssHashKey
 {
        Oid                     userid;                 /* user OID */
        Oid                     dbid;                   /* database OID */
-       int                     encoding;               /* query encoding */
        uint32          queryid;                /* query identifier */
 } pgssHashKey;
 
@@ -127,16 +162,18 @@ typedef struct Counters
 /*
  * Statistics per statement
  *
- * NB: see the file read/write code before changing field order here.
+ * Note: in event of a failure in garbage collection of the query text file,
+ * we reset query_offset to zero and query_len to -1.  This will be seen as
+ * an invalid state by qtext_fetch().
  */
 typedef struct pgssEntry
 {
        pgssHashKey key;                        /* hash key of entry - MUST BE FIRST */
        Counters        counters;               /* the statistics for this query */
+       Size            query_offset;   /* query text offset in external file */
        int                     query_len;              /* # of valid bytes in query string */
+       int                     encoding;               /* query text encoding */
        slock_t         mutex;                  /* protects the counters only */
-       char            query[1];               /* VARIABLE LENGTH ARRAY - MUST BE LAST */
-       /* Note: the allocated length of query[] is actually pgss->query_size */
 } pgssEntry;
 
 /*
@@ -144,9 +181,13 @@ typedef struct pgssEntry
  */
 typedef struct pgssSharedState
 {
-       LWLockId        lock;                   /* protects hashtable search/modification */
-       int                     query_size;             /* max query length in bytes */
+       LWLock     *lock;                       /* protects hashtable search/modification */
        double          cur_median_usage;               /* current median usage in hashtable */
+       Size            mean_query_len; /* current mean entry text length */
+       slock_t         mutex;                  /* protects following fields only: */
+       Size            extent;                 /* current extent of query file */
+       int                     n_writers;              /* number of active writers to query file */
+       int                     gc_count;               /* query file garbage collection cycle count */
 } pgssSharedState;
 
 /*
@@ -225,15 +266,21 @@ static bool pgss_save;                    /* whether to save stats across shutdown */
        (pgss_track == PGSS_TRACK_ALL || \
        (pgss_track == PGSS_TRACK_TOP && nested_level == 0))
 
+#define record_gc_qtexts() \
+       do { \
+               volatile pgssSharedState *s = (volatile pgssSharedState *) pgss; \
+               SpinLockAcquire(&s->mutex); \
+               s->gc_count++; \
+               SpinLockRelease(&s->mutex); \
+       } while(0)
+
 /*---- Function declarations ----*/
 
 void           _PG_init(void);
 void           _PG_fini(void);
 
-Datum          pg_stat_statements_reset(PG_FUNCTION_ARGS);
-Datum          pg_stat_statements(PG_FUNCTION_ARGS);
-
 PG_FUNCTION_INFO_V1(pg_stat_statements_reset);
+PG_FUNCTION_INFO_V1(pg_stat_statements_1_2);
 PG_FUNCTION_INFO_V1(pg_stat_statements);
 
 static void pgss_shmem_startup(void);
@@ -255,17 +302,25 @@ static void pgss_store(const char *query, uint32 queryId,
                   double total_time, uint64 rows,
                   const BufferUsage *bufusage,
                   pgssJumbleState *jstate);
+static void pg_stat_statements_internal(FunctionCallInfo fcinfo,
+                                                       pgssVersion api_version,
+                                                       bool showtext);
 static Size pgss_memsize(void);
-static pgssEntry *entry_alloc(pgssHashKey *key, const char *query,
-                       int query_len, bool sticky);
+static pgssEntry *entry_alloc(pgssHashKey *key, Size query_offset, int query_len,
+                       int encoding, bool sticky);
 static void entry_dealloc(void);
+static bool qtext_store(const char *query, int query_len,
+                       Size *query_offset, int *gc_count);
+static char *qtext_load_file(Size *buffer_size);
+static char *qtext_fetch(Size query_offset, int query_len,
+                       char *buffer, Size buffer_size);
+static bool need_gc_qtexts(void);
+static void gc_qtexts(void);
 static void entry_reset(void);
 #endif
 static void AppendJumble(pgssJumbleState *jstate,
                         const unsigned char *item, Size size);
-#ifdef NOT_USED
 static void JumbleQuery(pgssJumbleState *jstate, Query *query);
-#endif
 static void JumbleRangeTable(pgssJumbleState *jstate, List *rtable);
 static void JumbleExpr(pgssJumbleState *jstate, Node *node);
 static void RecordConstLocation(pgssJumbleState *jstate, int location);
@@ -275,9 +330,9 @@ static char *generate_normalized_query(pgssJumbleState *jstate, const char *quer
 #endif
 static void fill_in_constant_lengths(pgssJumbleState *jstate, const char *query);
 static int     comp_location(const void *a, const void *b);
-#ifdef NOT_USED
 
 
+#ifdef NOT_USED
 /*
  * Module load callback
  */
@@ -302,7 +357,7 @@ _PG_init(void)
          "Sets the maximum number of statements tracked by pg_stat_statements.",
                                                        NULL,
                                                        &pgss_max,
-                                                       1000,
+                                                       5000,
                                                        100,
                                                        INT_MAX,
                                                        PGC_POSTMASTER,
@@ -393,17 +448,20 @@ _PG_fini(void)
 /*
  * shmem_startup hook: allocate or attach to shared memory,
  * then load any pre-existing statistics from file.
+ * Also create and load the query-texts file, which is expected to exist
+ * (even if empty) while the module is enabled.
  */
 static void
 pgss_shmem_startup(void)
 {
        bool            found;
        HASHCTL         info;
-       FILE       *file;
+       FILE       *file = NULL;
+       FILE       *qfile = NULL;
        uint32          header;
        int32           num;
+       int32           pgver;
        int32           i;
-       int                     query_size;
        int                     buffer_size;
        char       *buffer = NULL;
 
@@ -427,16 +485,17 @@ pgss_shmem_startup(void)
        {
                /* First time through ... */
                pgss->lock = LWLockAssign();
-               pgss->query_size = pgstat_track_activity_query_size;
                pgss->cur_median_usage = ASSUMED_MEDIAN_INIT;
+               pgss->mean_query_len = ASSUMED_LENGTH_INIT;
+               SpinLockInit(&pgss->mutex);
+               pgss->extent = 0;
+               pgss->n_writers = 0;
+               pgss->gc_count = 0;
        }
 
-       /* Be sure everyone agrees on the hash table entry size */
-       query_size = pgss->query_size;
-
        memset(&info, 0, sizeof(info));
        info.keysize = sizeof(pgssHashKey);
-       info.entrysize = offsetof(pgssEntry, query) +query_size;
+       info.entrysize = sizeof(pgssEntry);
        info.hash = pgss_hash_fn;
        info.match = pgss_match_fn;
        pgss_hash = ShmemInitHash("pg_stat_statements hash",
@@ -454,68 +513,100 @@ pgss_shmem_startup(void)
                on_shmem_exit(pgss_shmem_shutdown, (Datum) 0);
 
        /*
-        * Attempt to load old statistics from the dump file, if this is the first
-        * time through and we weren't told not to.
+        * Done if some other process already completed our initialization.
         */
-       if (found || !pgss_save)
+       if (found)
                return;
 
        /*
         * Note: we don't bother with locks here, because there should be no other
         * processes running when this code is reached.
         */
+
+       /* Unlink query text file possibly left over from crash */
+       unlink(PGSS_TEXT_FILE);
+
+       /* Allocate new query text temp file */
+       qfile = AllocateFile(PGSS_TEXT_FILE, PG_BINARY_W);
+       if (qfile == NULL)
+               goto write_error;
+
+       /*
+        * If we were told not to load old statistics, we're done.  (Note we do
+        * not try to unlink any old dump file in this case.  This seems a bit
+        * questionable but it's the historical behavior.)
+        */
+       if (!pgss_save)
+       {
+               FreeFile(qfile);
+               return;
+       }
+
+       /*
+        * Attempt to load old statistics from the dump file.
+        */
        file = AllocateFile(PGSS_DUMP_FILE, PG_BINARY_R);
        if (file == NULL)
        {
-               if (errno == ENOENT)
-                       return;                         /* ignore not-found error */
-               goto error;
+               if (errno != ENOENT)
+                       goto read_error;
+               /* No existing persisted stats file, so we're done */
+               FreeFile(qfile);
+               return;
        }
 
-       buffer_size = query_size;
+       buffer_size = 2048;
        buffer = (char *) palloc(buffer_size);
 
        if (fread(&header, sizeof(uint32), 1, file) != 1 ||
-               header != PGSS_FILE_HEADER ||
+               fread(&pgver, sizeof(uint32), 1, file) != 1 ||
                fread(&num, sizeof(int32), 1, file) != 1)
-               goto error;
+               goto read_error;
+
+       if (header != PGSS_FILE_HEADER ||
+               pgver != PGSS_PG_MAJOR_VERSION)
+               goto data_error;
 
        for (i = 0; i < num; i++)
        {
                pgssEntry       temp;
                pgssEntry  *entry;
+               Size            query_offset;
 
-               if (fread(&temp, offsetof(pgssEntry, mutex), 1, file) != 1)
-                       goto error;
+               if (fread(&temp, sizeof(pgssEntry), 1, file) != 1)
+                       goto read_error;
 
                /* Encoding is the only field we can easily sanity-check */
-               if (!PG_VALID_BE_ENCODING(temp.key.encoding))
-                       goto error;
+               if (!PG_VALID_BE_ENCODING(temp.encoding))
+                       goto data_error;
 
-               /* Previous incarnation might have had a larger query_size */
+               /* Resize buffer as needed */
                if (temp.query_len >= buffer_size)
                {
-                       buffer = (char *) repalloc(buffer, temp.query_len + 1);
-                       buffer_size = temp.query_len + 1;
+                       buffer_size = Max(buffer_size * 2, temp.query_len + 1);
+                       buffer = repalloc(buffer, buffer_size);
                }
 
-               if (fread(buffer, 1, temp.query_len, file) != temp.query_len)
-                       goto error;
+               if (fread(buffer, 1, temp.query_len + 1, file) != temp.query_len + 1)
+                       goto read_error;
+
+               /* Should have a trailing null, but let's make sure */
                buffer[temp.query_len] = '\0';
 
                /* Skip loading "sticky" entries */
                if (temp.counters.calls == 0)
                        continue;
 
-               /* Clip to available length if needed */
-               if (temp.query_len >= query_size)
-                       temp.query_len = pg_encoding_mbcliplen(temp.key.encoding,
-                                                                                                  buffer,
-                                                                                                  temp.query_len,
-                                                                                                  query_size - 1);
+               /* Store the query text */
+               query_offset = pgss->extent;
+               if (fwrite(buffer, 1, temp.query_len + 1, qfile) != temp.query_len + 1)
+                       goto write_error;
+               pgss->extent += temp.query_len + 1;
 
                /* make the hashtable entry (discards old entries if too many) */
-               entry = entry_alloc(&temp.key, buffer, temp.query_len, false);
+               entry = entry_alloc(&temp.key, query_offset, temp.query_len,
+                                                       temp.encoding,
+                                                       false);
 
                /* copy in the actual stats */
                entry->counters = temp.counters;
@@ -523,26 +614,56 @@ pgss_shmem_startup(void)
 
        pfree(buffer);
        FreeFile(file);
+       FreeFile(qfile);
 
        /*
-        * Remove the file so it's not included in backups/replication slaves,
-        * etc. A new file will be written on next shutdown.
+        * Remove the persisted stats file so it's not included in
+        * backups/replication slaves, etc.  A new file will be written on next
+        * shutdown.
+        *
+        * Note: it's okay if the PGSS_TEXT_FILE is included in a basebackup,
+        * because we remove that file on startup; it acts inversely to
+        * PGSS_DUMP_FILE, in that it is only supposed to be around when the
+        * server is running, whereas PGSS_DUMP_FILE is only supposed to be around
+        * when the server is not running.  Leaving the file creates no danger of
+        * a newly restored database having a spurious record of execution costs,
+        * which is what we're really concerned about here.
         */
        unlink(PGSS_DUMP_FILE);
 
        return;
 
-error:
+read_error:
        ereport(LOG,
                        (errcode_for_file_access(),
                         errmsg("could not read pg_stat_statement file \"%s\": %m",
                                        PGSS_DUMP_FILE)));
+       goto fail;
+data_error:
+       ereport(LOG,
+                       (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                        errmsg("ignoring invalid data in pg_stat_statement file \"%s\"",
+                                       PGSS_DUMP_FILE)));
+       goto fail;
+write_error:
+       ereport(LOG,
+                       (errcode_for_file_access(),
+                        errmsg("could not write pg_stat_statement file \"%s\": %m",
+                                       PGSS_TEXT_FILE)));
+fail:
        if (buffer)
                pfree(buffer);
        if (file)
                FreeFile(file);
+       if (qfile)
+               FreeFile(qfile);
        /* If possible, throw away the bogus file; ignore any error */
        unlink(PGSS_DUMP_FILE);
+
+       /*
+        * Don't unlink PGSS_TEXT_FILE here; it should always be around while the
+        * server is running with pg_stat_statements enabled
+        */
 }
 
 /*
@@ -555,6 +676,8 @@ static void
 pgss_shmem_shutdown(int code, Datum arg)
 {
        FILE       *file;
+       char       *qbuffer = NULL;
+       Size            qbuffer_size = 0;
        HASH_SEQ_STATUS hash_seq;
        int32           num_entries;
        pgssEntry  *entry;
@@ -577,20 +700,42 @@ pgss_shmem_shutdown(int code, Datum arg)
 
        if (fwrite(&PGSS_FILE_HEADER, sizeof(uint32), 1, file) != 1)
                goto error;
+       if (fwrite(&PGSS_PG_MAJOR_VERSION, sizeof(uint32), 1, file) != 1)
+               goto error;
        num_entries = hash_get_num_entries(pgss_hash);
        if (fwrite(&num_entries, sizeof(int32), 1, file) != 1)
                goto error;
 
+       qbuffer = qtext_load_file(&qbuffer_size);
+       if (qbuffer == NULL)
+               goto error;
+
+       /*
+        * When serializing to disk, we store query texts immediately after their
+        * entry data.  Any orphaned query texts are thereby excluded.
+        */
        hash_seq_init(&hash_seq, pgss_hash);
        while ((entry = hash_seq_search(&hash_seq)) != NULL)
        {
                int                     len = entry->query_len;
+               char       *qstr = qtext_fetch(entry->query_offset, len,
+                                                                          qbuffer, qbuffer_size);
+
+               if (qstr == NULL)
+                       continue;                       /* Ignore any entries with bogus texts */
 
-               if (fwrite(entry, offsetof(pgssEntry, mutex), 1, file) != 1 ||
-                       fwrite(entry->query, 1, len, file) != len)
+               if (fwrite(entry, sizeof(pgssEntry), 1, file) != 1 ||
+                       fwrite(qstr, 1, len + 1, file) != len + 1)
+               {
+                       /* note: we assume hash_seq_term won't change errno */
+                       hash_seq_term(&hash_seq);
                        goto error;
+               }
        }
 
+       free(qbuffer);
+       qbuffer = NULL;
+
        if (FreeFile(file))
        {
                file = NULL;
@@ -598,7 +743,7 @@ pgss_shmem_shutdown(int code, Datum arg)
        }
 
        /*
-        * Rename file into place, so we atomically replace the old one.
+        * Rename file into place, so we atomically replace any old one.
         */
        if (rename(PGSS_DUMP_FILE ".tmp", PGSS_DUMP_FILE) != 0)
                ereport(LOG,
@@ -606,6 +751,9 @@ pgss_shmem_shutdown(int code, Datum arg)
                                 errmsg("could not rename pg_stat_statement file \"%s\": %m",
                                                PGSS_DUMP_FILE ".tmp")));
 
+       /* Unlink query-texts file; it's not needed while shutdown */
+       unlink(PGSS_TEXT_FILE);
+
        return;
 
 error:
@@ -613,9 +761,12 @@ error:
                        (errcode_for_file_access(),
                         errmsg("could not write pg_stat_statement file \"%s\": %m",
                                        PGSS_DUMP_FILE ".tmp")));
+       if (qbuffer)
+               free(qbuffer);
        if (file)
                FreeFile(file);
        unlink(PGSS_DUMP_FILE ".tmp");
+       unlink(PGSS_TEXT_FILE);
 }
 
 /*
@@ -626,6 +777,9 @@ pgss_post_parse_analyze(ParseState *pstate, Query *query)
 {
        pgssJumbleState jstate;
 
+       if (prev_post_parse_analyze_hook)
+               prev_post_parse_analyze_hook(pstate, query);
+
        /* Assert we didn't do this already */
        Assert(query->queryId == 0);
 
@@ -818,7 +972,7 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString,
        {
                instr_time      start;
                instr_time      duration;
-               uint64          rows = 0;
+               uint64          rows;
                BufferUsage bufusage_start,
                                        bufusage;
                uint32          queryId;
@@ -851,7 +1005,15 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString,
 
                /* parse command tag to retrieve the number of affected rows. */
                if (completionTag &&
-                       sscanf(completionTag, "COPY " UINT64_FORMAT, &rows) != 1)
+                       strncmp(completionTag, "COPY ", 5) == 0)
+               {
+#ifdef HAVE_STRTOULL
+                       rows = strtoull(completionTag + 5, NULL, 10);
+#else
+                       rows = strtoul(completionTag + 5, NULL, 10);
+#endif
+               }
+               else
                        rows = 0;
 
                /* calc differences of buffer counters. */
@@ -911,7 +1073,6 @@ pgss_hash_fn(const void *key, Size keysize)
 {
        const pgssHashKey *k = (const pgssHashKey *) key;
 
-       /* we don't bother to include encoding in the hash */
        return hash_uint32((uint32) k->userid) ^
                hash_uint32((uint32) k->dbid) ^
                hash_uint32((uint32) k->queryid);
@@ -928,7 +1089,6 @@ pgss_match_fn(const void *key1, const void *key2, Size keysize)
 
        if (k1->userid == k2->userid &&
                k1->dbid == k2->dbid &&
-               k1->encoding == k2->encoding &&
                k1->queryid == k2->queryid)
                return 0;
        else
@@ -962,6 +1122,8 @@ pgss_store(const char *query, uint32 queryId,
        pgssHashKey key;
        pgssEntry  *entry;
        char       *norm_query = NULL;
+       int                     encoding = GetDatabaseEncoding();
+       int                     query_len;
 
        Assert(query != NULL);
 
@@ -969,10 +1131,11 @@ pgss_store(const char *query, uint32 queryId,
        if (!pgss || !pgss_hash)
                return;
 
+       query_len = strlen(query);
+
        /* Set up key for hashtable search */
        key.userid = GetUserId();
        key.dbid = MyDatabaseId;
-       key.encoding = GetDatabaseEncoding();
        key.queryid = queryId;
 
        /* Lookup the hash table entry with shared lock. */
@@ -983,45 +1146,64 @@ pgss_store(const char *query, uint32 queryId,
        /* Create new entry, if not present */
        if (!entry)
        {
-               int                     query_len;
+               Size            query_offset;
+               int                     gc_count;
+               bool            stored;
+               bool            do_gc;
 
                /*
-                * We'll need exclusive lock to make a new entry.  There is no point
-                * in holding shared lock while we normalize the string, though.
+                * Create a new, normalized query string if caller asked.  We don't
+                * need to hold the lock while doing this work.  (Note: in any case,
+                * it's possible that someone else creates a duplicate hashtable entry
+                * in the interval where we don't hold the lock below.  That case is
+                * handled by entry_alloc.)
                 */
-               LWLockRelease(pgss->lock);
-
-               query_len = strlen(query);
-
                if (jstate)
                {
-                       /* Normalize the string if enabled */
+                       LWLockRelease(pgss->lock);
                        norm_query = generate_normalized_query(jstate, query,
                                                                                                   &query_len,
-                                                                                                  key.encoding);
+                                                                                                  encoding);
+                       LWLockAcquire(pgss->lock, LW_SHARED);
+               }
 
-                       /* Acquire exclusive lock as required by entry_alloc() */
-                       LWLockAcquire(pgss->lock, LW_EXCLUSIVE);
+               /* Append new query text to file with only shared lock held */
+               stored = qtext_store(norm_query ? norm_query : query, query_len,
+                                                        &query_offset, &gc_count);
 
-                       entry = entry_alloc(&key, norm_query, query_len, true);
-               }
-               else
-               {
-                       /*
-                        * We're just going to store the query string as-is; but we have
-                        * to truncate it if over-length.
-                        */
-                       if (query_len >= pgss->query_size)
-                               query_len = pg_encoding_mbcliplen(key.encoding,
-                                                                                                 query,
-                                                                                                 query_len,
-                                                                                                 pgss->query_size - 1);
+               /*
+                * Determine whether we need to garbage collect external query texts
+                * while the shared lock is still held.  This micro-optimization
+                * avoids taking the time to decide this while holding exclusive lock.
+                */
+               do_gc = need_gc_qtexts();
 
-                       /* Acquire exclusive lock as required by entry_alloc() */
-                       LWLockAcquire(pgss->lock, LW_EXCLUSIVE);
+               /* Need exclusive lock to make a new hashtable entry - promote */
+               LWLockRelease(pgss->lock);
+               LWLockAcquire(pgss->lock, LW_EXCLUSIVE);
 
-                       entry = entry_alloc(&key, query, query_len, false);
-               }
+               /*
+                * A garbage collection may have occurred while we weren't holding the
+                * lock.  In the unlikely event that this happens, the query text we
+                * stored above will have been garbage collected, so write it again.
+                * This should be infrequent enough that doing it while holding
+                * exclusive lock isn't a performance problem.
+                */
+               if (!stored || pgss->gc_count != gc_count)
+                       stored = qtext_store(norm_query ? norm_query : query, query_len,
+                                                                &query_offset, NULL);
+
+               /* If we failed to write to the text file, give up */
+               if (!stored)
+                       goto done;
+
+               /* OK to create a new hashtable entry */
+               entry = entry_alloc(&key, query_offset, query_len, encoding,
+                                                       jstate != NULL);
+
+               /* If needed, perform garbage collection while exclusive lock held */
+               if (do_gc)
+                       gc_qtexts();
        }
 
        /* Increment the counts, except when jstate is not NULL */
@@ -1059,9 +1241,10 @@ pgss_store(const char *query, uint32 queryId,
                SpinLockRelease(&e->mutex);
        }
 
+done:
        LWLockRelease(pgss->lock);
 
-       /* We postpone this pfree until we're out of the lock */
+       /* We postpone this clean-up until we're out of the lock */
        if (norm_query)
                pfree(norm_query);
 }
@@ -1080,15 +1263,51 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS)
        PG_RETURN_VOID();
 }
 
+/* Number of output arguments (columns) for various API versions */
 #define PG_STAT_STATEMENTS_COLS_V1_0   14
-#define PG_STAT_STATEMENTS_COLS                        18
+#define PG_STAT_STATEMENTS_COLS_V1_1   18
+#define PG_STAT_STATEMENTS_COLS_V1_2   19
+#define PG_STAT_STATEMENTS_COLS                        19              /* maximum of above */
 
 /*
  * Retrieve statement statistics.
+ *
+ * The SQL API of this function has changed multiple times, and will likely
+ * do so again in future.  To support the case where a newer version of this
+ * loadable module is being used with an old SQL declaration of the function,
+ * we continue to support the older API versions.  For 1.2 and later, the
+ * expected API version is identified by embedding it in the C name of the
+ * function.  Unfortunately we weren't bright enough to do that for 1.1.
+ */
+Datum
+pg_stat_statements_1_2(PG_FUNCTION_ARGS)
+{
+       bool            showtext = PG_GETARG_BOOL(0);
+
+       pg_stat_statements_internal(fcinfo, PGSS_V1_2, showtext);
+
+       return (Datum) 0;
+}
+
+/*
+ * Legacy entry point for pg_stat_statements() API versions 1.0 and 1.1.
+ * This can be removed someday, perhaps.
  */
 Datum
 pg_stat_statements(PG_FUNCTION_ARGS)
 {
+       /* If it's really API 1.1, we'll figure that out below */
+       pg_stat_statements_internal(fcinfo, PGSS_V1_0, true);
+
+       return (Datum) 0;
+}
+
+/* Common code for all versions of pg_stat_statements() */
+static void
+pg_stat_statements_internal(FunctionCallInfo fcinfo,
+                                                       pgssVersion api_version,
+                                                       bool showtext)
+{
        ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
        TupleDesc       tupdesc;
        Tuplestorestate *tupstore;
@@ -1096,10 +1315,14 @@ pg_stat_statements(PG_FUNCTION_ARGS)
        MemoryContext oldcontext;
        Oid                     userid = GetUserId();
        bool            is_superuser = superuser();
+       char       *qbuffer = NULL;
+       Size            qbuffer_size = 0;
+       Size            extent = 0;
+       int                     gc_count = 0;
        HASH_SEQ_STATUS hash_seq;
        pgssEntry  *entry;
-       bool            sql_supports_v1_1_counters = true;
 
+       /* hash table must exist already */
        if (!pgss || !pgss_hash)
                ereport(ERROR,
                                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
@@ -1116,14 +1339,38 @@ pg_stat_statements(PG_FUNCTION_ARGS)
                                 errmsg("materialize mode required, but it is not " \
                                                "allowed in this context")));
 
+       /* Switch into long-lived context to construct returned data structures */
+       per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
+       oldcontext = MemoryContextSwitchTo(per_query_ctx);
+
        /* Build a tuple descriptor for our result type */
        if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
                elog(ERROR, "return type must be a row type");
-       if (tupdesc->natts == PG_STAT_STATEMENTS_COLS_V1_0)
-               sql_supports_v1_1_counters = false;
 
-       per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
-       oldcontext = MemoryContextSwitchTo(per_query_ctx);
+       /*
+        * Check we have the expected number of output arguments.  Aside from
+        * being a good safety check, we need a kluge here to detect API version
+        * 1.1, which was wedged into the code in an ill-considered way.
+        */
+       switch (tupdesc->natts)
+       {
+               case PG_STAT_STATEMENTS_COLS_V1_0:
+                       if (api_version != PGSS_V1_0)
+                               elog(ERROR, "incorrect number of output arguments");
+                       break;
+               case PG_STAT_STATEMENTS_COLS_V1_1:
+                       /* pg_stat_statements() should have told us 1.0 */
+                       if (api_version != PGSS_V1_0)
+                               elog(ERROR, "incorrect number of output arguments");
+                       api_version = PGSS_V1_1;
+                       break;
+               case PG_STAT_STATEMENTS_COLS_V1_2:
+                       if (api_version != PGSS_V1_2)
+                               elog(ERROR, "incorrect number of output arguments");
+                       break;
+               default:
+                       elog(ERROR, "incorrect number of output arguments");
+       }
 
        tupstore = tuplestore_begin_heap(true, false, work_mem);
        rsinfo->returnMode = SFRM_Materialize;
@@ -1132,8 +1379,71 @@ pg_stat_statements(PG_FUNCTION_ARGS)
 
        MemoryContextSwitchTo(oldcontext);
 
+       /*
+        * We'd like to load the query text file (if needed) while not holding any
+        * lock on pgss->lock.  In the worst case we'll have to do this again
+        * after we have the lock, but it's unlikely enough to make this a win
+        * despite occasional duplicated work.  We need to reload if anybody
+        * writes to the file (either a retail qtext_store(), or a garbage
+        * collection) between this point and where we've gotten shared lock.  If
+        * a qtext_store is actually in progress when we look, we might as well
+        * skip the speculative load entirely.
+        */
+       if (showtext)
+       {
+               int                     n_writers;
+
+               /* Take the mutex so we can examine variables */
+               {
+                       volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
+
+                       SpinLockAcquire(&s->mutex);
+                       extent = s->extent;
+                       n_writers = s->n_writers;
+                       gc_count = s->gc_count;
+                       SpinLockRelease(&s->mutex);
+               }
+
+               /* No point in loading file now if there are active writers */
+               if (n_writers == 0)
+                       qbuffer = qtext_load_file(&qbuffer_size);
+       }
+
+       /*
+        * Get shared lock, load or reload the query text file if we must, and
+        * iterate over the hashtable entries.
+        *
+        * With a large hash table, we might be holding the lock rather longer
+        * than one could wish.  However, this only blocks creation of new hash
+        * table entries, and the larger the hash table the less likely that is to
+        * be needed.  So we can hope this is okay.  Perhaps someday we'll decide
+        * we need to partition the hash table to limit the time spent holding any
+        * one lock.
+        */
        LWLockAcquire(pgss->lock, LW_SHARED);
 
+       if (showtext)
+       {
+               /*
+                * Here it is safe to examine extent and gc_count without taking the
+                * mutex.  Note that although other processes might change
+                * pgss->extent just after we look at it, the strings they then write
+                * into the file cannot yet be referenced in the hashtable, so we
+                * don't care whether we see them or not.
+                *
+                * If qtext_load_file fails, we just press on; we'll return NULL for
+                * every query text.
+                */
+               if (qbuffer == NULL ||
+                       pgss->extent != extent ||
+                       pgss->gc_count != gc_count)
+               {
+                       if (qbuffer)
+                               free(qbuffer);
+                       qbuffer = qtext_load_file(&qbuffer_size);
+               }
+       }
+
        hash_seq_init(&hash_seq, pgss_hash);
        while ((entry = hash_seq_search(&hash_seq)) != NULL)
        {
@@ -1141,6 +1451,7 @@ pg_stat_statements(PG_FUNCTION_ARGS)
                bool            nulls[PG_STAT_STATEMENTS_COLS];
                int                     i = 0;
                Counters        tmp;
+               int64           queryid = entry->key.queryid;
 
                memset(values, 0, sizeof(values));
                memset(nulls, 0, sizeof(nulls));
@@ -1150,19 +1461,56 @@ pg_stat_statements(PG_FUNCTION_ARGS)
 
                if (is_superuser || entry->key.userid == userid)
                {
-                       char       *qstr;
-
-                       qstr = (char *)
-                               pg_do_encoding_conversion((unsigned char *) entry->query,
-                                                                                 entry->query_len,
-                                                                                 entry->key.encoding,
-                                                                                 GetDatabaseEncoding());
-                       values[i++] = CStringGetTextDatum(qstr);
-                       if (qstr != entry->query)
-                               pfree(qstr);
+                       if (api_version >= PGSS_V1_2)
+                               values[i++] = Int64GetDatumFast(queryid);
+
+                       if (showtext)
+                       {
+                               char       *qstr = qtext_fetch(entry->query_offset,
+                                                                                          entry->query_len,
+                                                                                          qbuffer,
+                                                                                          qbuffer_size);
+
+                               if (qstr)
+                               {
+                                       char       *enc;
+
+                                       enc = pg_any_to_server(qstr,
+                                                                                  entry->query_len,
+                                                                                  entry->encoding);
+
+                                       values[i++] = CStringGetTextDatum(enc);
+
+                                       if (enc != qstr)
+                                               pfree(enc);
+                               }
+                               else
+                               {
+                                       /* Just return a null if we fail to find the text */
+                                       nulls[i++] = true;
+                               }
+                       }
+                       else
+                       {
+                               /* Query text not requested */
+                               nulls[i++] = true;
+                       }
                }
                else
-                       values[i++] = CStringGetTextDatum("<insufficient privilege>");
+               {
+                       /* Don't show queryid */
+                       if (api_version >= PGSS_V1_2)
+                               nulls[i++] = true;
+
+                       /*
+                        * Don't show query text, but hint as to the reason for not doing
+                        * so if it was requested
+                        */
+                       if (showtext)
+                               values[i++] = CStringGetTextDatum("<insufficient privilege>");
+                       else
+                               nulls[i++] = true;
+               }
 
                /* copy counters to a local variable to keep locking time short */
                {
@@ -1182,34 +1530,37 @@ pg_stat_statements(PG_FUNCTION_ARGS)
                values[i++] = Int64GetDatumFast(tmp.rows);
                values[i++] = Int64GetDatumFast(tmp.shared_blks_hit);
                values[i++] = Int64GetDatumFast(tmp.shared_blks_read);
-               if (sql_supports_v1_1_counters)
+               if (api_version >= PGSS_V1_1)
                        values[i++] = Int64GetDatumFast(tmp.shared_blks_dirtied);
                values[i++] = Int64GetDatumFast(tmp.shared_blks_written);
                values[i++] = Int64GetDatumFast(tmp.local_blks_hit);
                values[i++] = Int64GetDatumFast(tmp.local_blks_read);
-               if (sql_supports_v1_1_counters)
+               if (api_version >= PGSS_V1_1)
                        values[i++] = Int64GetDatumFast(tmp.local_blks_dirtied);
                values[i++] = Int64GetDatumFast(tmp.local_blks_written);
                values[i++] = Int64GetDatumFast(tmp.temp_blks_read);
                values[i++] = Int64GetDatumFast(tmp.temp_blks_written);
-               if (sql_supports_v1_1_counters)
+               if (api_version >= PGSS_V1_1)
                {
                        values[i++] = Float8GetDatumFast(tmp.blk_read_time);
                        values[i++] = Float8GetDatumFast(tmp.blk_write_time);
                }
 
-               Assert(i == (sql_supports_v1_1_counters ?
-                                        PG_STAT_STATEMENTS_COLS : PG_STAT_STATEMENTS_COLS_V1_0));
+               Assert(i == (api_version == PGSS_V1_0 ? PG_STAT_STATEMENTS_COLS_V1_0 :
+                                        api_version == PGSS_V1_1 ? PG_STAT_STATEMENTS_COLS_V1_1 :
+                                        api_version == PGSS_V1_2 ? PG_STAT_STATEMENTS_COLS_V1_2 :
+                                        -1 /* fail if you forget to update this assert */ ));
 
                tuplestore_putvalues(tupstore, tupdesc, values, nulls);
        }
 
+       /* clean up and return the tuplestore */
        LWLockRelease(pgss->lock);
 
-       /* clean up and return the tuplestore */
-       tuplestore_donestoring(tupstore);
+       if (qbuffer)
+               free(qbuffer);
 
-       return (Datum) 0;
+       tuplestore_donestoring(tupstore);
 }
 
 /*
@@ -1219,11 +1570,9 @@ static Size
 pgss_memsize(void)
 {
        Size            size;
-       Size            entrysize;
 
        size = MAXALIGN(sizeof(pgssSharedState));
-       entrysize = offsetof(pgssEntry, query) +pgstat_track_activity_query_size;
-       size = add_size(size, hash_estimate_size(pgss_max, entrysize));
+       size = add_size(size, hash_estimate_size(pgss_max, sizeof(pgssEntry)));
 
        return size;
 }
@@ -1241,12 +1590,13 @@ pgss_memsize(void)
  * would be difficult to demonstrate this even under artificial conditions.)
  *
  * Note: despite needing exclusive lock, it's not an error for the target
- * entry to already exist.     This is because pgss_store releases and
+ * entry to already exist.  This is because pgss_store releases and
  * reacquires lock after failing to find a match; so someone else could
  * have made the entry while we waited to get exclusive lock.
  */
 static pgssEntry *
-entry_alloc(pgssHashKey *key, const char *query, int query_len, bool sticky)
+entry_alloc(pgssHashKey *key, Size query_offset, int query_len, int encoding,
+                       bool sticky)
 {
        pgssEntry  *entry;
        bool            found;
@@ -1268,11 +1618,11 @@ entry_alloc(pgssHashKey *key, const char *query, int query_len, bool sticky)
                entry->counters.usage = sticky ? pgss->cur_median_usage : USAGE_INIT;
                /* re-initialize the mutex each time ... we assume no one using it */
                SpinLockInit(&entry->mutex);
-               /* ... and don't forget the query text */
-               Assert(query_len >= 0 && query_len < pgss->query_size);
+               /* ... and don't forget the query text metadata */
+               Assert(query_len >= 0);
+               entry->query_offset = query_offset;
                entry->query_len = query_len;
-               memcpy(entry->query, query, query_len);
-               entry->query[query_len] = '\0';
+               entry->encoding = encoding;
        }
 
        return entry;
@@ -1307,6 +1657,7 @@ entry_dealloc(void)
        pgssEntry  *entry;
        int                     nvictims;
        int                     i;
+       Size            totlen = 0;
 
        /*
         * Sort entries by usage and deallocate USAGE_DEALLOC_PERCENT of them.
@@ -1326,13 +1677,19 @@ entry_dealloc(void)
                        entry->counters.usage *= STICKY_DECREASE_FACTOR;
                else
                        entry->counters.usage *= USAGE_DECREASE_FACTOR;
+               /* Accumulate total size, too. */
+               totlen += entry->query_len + 1;
        }
 
        qsort(entries, i, sizeof(pgssEntry *), entry_cmp);
 
-       /* Also, record the (approximate) median usage */
        if (i > 0)
+       {
+               /* Record the (approximate) median usage */
                pgss->cur_median_usage = entries[i / 2]->counters.usage;
+               /* Record the mean query length */
+               pgss->mean_query_len = totlen / i;
+       }
 
        nvictims = Max(10, i * USAGE_DEALLOC_PERCENT / 100);
        nvictims = Min(nvictims, i);
@@ -1346,6 +1703,396 @@ entry_dealloc(void)
 }
 
 /*
+ * Given a null-terminated string, allocate a new entry in the external query
+ * text file and store the string there.
+ *
+ * Although we could compute the string length via strlen(), callers already
+ * have it handy, so we require them to pass it too.
+ *
+ * If successful, returns true, and stores the new entry's offset in the file
+ * into *query_offset.  Also, if gc_count isn't NULL, *gc_count is set to the
+ * number of garbage collections that have occurred so far.
+ *
+ * On failure, returns false.
+ *
+ * At least a shared lock on pgss->lock must be held by the caller, so as
+ * to prevent a concurrent garbage collection.  Share-lock-holding callers
+ * should pass a gc_count pointer to obtain the number of garbage collections,
+ * so that they can recheck the count after obtaining exclusive lock to
+ * detect whether a garbage collection occurred (and removed this entry).
+ */
+static bool
+qtext_store(const char *query, int query_len,
+                       Size *query_offset, int *gc_count)
+{
+       Size            off;
+       int                     fd;
+
+       /*
+        * We use a spinlock to protect extent/n_writers/gc_count, so that
+        * multiple processes may execute this function concurrently.
+        */
+       {
+               volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
+
+               SpinLockAcquire(&s->mutex);
+               off = s->extent;
+               s->extent += query_len + 1;
+               s->n_writers++;
+               if (gc_count)
+                       *gc_count = s->gc_count;
+               SpinLockRelease(&s->mutex);
+       }
+
+       *query_offset = off;
+
+       /* Now write the data into the successfully-reserved part of the file */
+       fd = OpenTransientFile(PGSS_TEXT_FILE, O_RDWR | O_CREAT | PG_BINARY,
+                                                  S_IRUSR | S_IWUSR);
+       if (fd < 0)
+               goto error;
+
+       if (lseek(fd, off, SEEK_SET) != off)
+               goto error;
+
+       if (write(fd, query, query_len + 1) != query_len + 1)
+               goto error;
+
+       CloseTransientFile(fd);
+
+       /* Mark our write complete */
+       {
+               volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
+
+               SpinLockAcquire(&s->mutex);
+               s->n_writers--;
+               SpinLockRelease(&s->mutex);
+       }
+
+       return true;
+
+error:
+       ereport(LOG,
+                       (errcode_for_file_access(),
+                        errmsg("could not write pg_stat_statement file \"%s\": %m",
+                                       PGSS_TEXT_FILE)));
+
+       if (fd >= 0)
+               CloseTransientFile(fd);
+
+       /* Mark our write complete */
+       {
+               volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
+
+               SpinLockAcquire(&s->mutex);
+               s->n_writers--;
+               SpinLockRelease(&s->mutex);
+       }
+
+       return false;
+}
+
+/*
+ * Read the external query text file into a malloc'd buffer.
+ *
+ * Returns NULL (without throwing an error) if unable to read, eg
+ * file not there or insufficient memory.
+ *
+ * On success, the buffer size is also returned into *buffer_size.
+ *
+ * This can be called without any lock on pgss->lock, but in that case
+ * the caller is responsible for verifying that the result is sane.
+ */
+static char *
+qtext_load_file(Size *buffer_size)
+{
+       char       *buf;
+       int                     fd;
+       struct stat stat;
+
+       fd = OpenTransientFile(PGSS_TEXT_FILE, O_RDONLY | PG_BINARY, 0);
+       if (fd < 0)
+       {
+               if (errno != ENOENT)
+                       ereport(LOG,
+                                       (errcode_for_file_access(),
+                                  errmsg("could not read pg_stat_statement file \"%s\": %m",
+                                                 PGSS_TEXT_FILE)));
+               return NULL;
+       }
+
+       /* Get file length */
+       if (fstat(fd, &stat))
+       {
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                                errmsg("could not stat pg_stat_statement file \"%s\": %m",
+                                               PGSS_TEXT_FILE)));
+               CloseTransientFile(fd);
+               return NULL;
+       }
+
+       /* Allocate buffer; beware that off_t might be wider than size_t */
+       if (stat.st_size <= MaxAllocSize)
+               buf = (char *) malloc(stat.st_size);
+       else
+               buf = NULL;
+       if (buf == NULL)
+       {
+               ereport(LOG,
+                               (errcode(ERRCODE_OUT_OF_MEMORY),
+                                errmsg("out of memory")));
+               CloseTransientFile(fd);
+               return NULL;
+       }
+
+       /*
+        * OK, slurp in the file.  If we get a short read and errno doesn't get
+        * set, the reason is probably that garbage collection truncated the file
+        * since we did the fstat(), so we don't log a complaint --- but we don't
+        * return the data, either, since it's most likely corrupt due to
+        * concurrent writes from garbage collection.
+        */
+       errno = 0;
+       if (read(fd, buf, stat.st_size) != stat.st_size)
+       {
+               if (errno)
+                       ereport(LOG,
+                                       (errcode_for_file_access(),
+                                  errmsg("could not read pg_stat_statement file \"%s\": %m",
+                                                 PGSS_TEXT_FILE)));
+               free(buf);
+               CloseTransientFile(fd);
+               return NULL;
+       }
+
+       CloseTransientFile(fd);
+
+       *buffer_size = stat.st_size;
+       return buf;
+}
+
+/*
+ * Locate a query text in the file image previously read by qtext_load_file().
+ *
+ * We validate the given offset/length, and return NULL if bogus.  Otherwise,
+ * the result points to a null-terminated string within the buffer.
+ */
+static char *
+qtext_fetch(Size query_offset, int query_len,
+                       char *buffer, Size buffer_size)
+{
+       /* File read failed? */
+       if (buffer == NULL)
+               return NULL;
+       /* Bogus offset/length? */
+       if (query_len < 0 ||
+               query_offset + query_len >= buffer_size)
+               return NULL;
+       /* As a further sanity check, make sure there's a trailing null */
+       if (buffer[query_offset + query_len] != '\0')
+               return NULL;
+       /* Looks OK */
+       return buffer + query_offset;
+}
+
+/*
+ * Do we need to garbage-collect the external query text file?
+ *
+ * Caller should hold at least a shared lock on pgss->lock.
+ */
+static bool
+need_gc_qtexts(void)
+{
+       Size            extent;
+
+       /* Read shared extent pointer */
+       {
+               volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
+
+               SpinLockAcquire(&s->mutex);
+               extent = s->extent;
+               SpinLockRelease(&s->mutex);
+       }
+
+       /* Don't proceed if file does not exceed 512 bytes per possible entry */
+       if (extent < 512 * pgss_max)
+               return false;
+
+       /*
+        * Don't proceed if file is less than about 50% bloat.  Nothing can or
+        * should be done in the event of unusually large query texts accounting
+        * for file's large size.  We go to the trouble of maintaining the mean
+        * query length in order to prevent garbage collection from thrashing
+        * uselessly.
+        */
+       if (extent < pgss->mean_query_len * pgss_max * 2)
+               return false;
+
+       return true;
+}
+
+/*
+ * Garbage-collect orphaned query texts in external file.
+ *
+ * This won't be called often in the typical case, since it's likely that
+ * there won't be too much churn, and besides, a similar compaction process
+ * occurs when serializing to disk at shutdown or as part of resetting.
+ * Despite this, it seems prudent to plan for the edge case where the file
+ * becomes unreasonably large, with no other method of compaction likely to
+ * occur in the foreseeable future.
+ *
+ * The caller must hold an exclusive lock on pgss->lock.
+ */
+static void
+gc_qtexts(void)
+{
+       char       *qbuffer;
+       Size            qbuffer_size;
+       FILE       *qfile;
+       HASH_SEQ_STATUS hash_seq;
+       pgssEntry  *entry;
+       Size            extent;
+       int                     nentries;
+
+       /*
+        * When called from pgss_store, some other session might have proceeded
+        * with garbage collection in the no-lock-held interim of lock strength
+        * escalation.  Check once more that this is actually necessary.
+        */
+       if (!need_gc_qtexts())
+               return;
+
+       /*
+        * Load the old texts file.  If we fail (out of memory, for instance) just
+        * skip the garbage collection.
+        */
+       qbuffer = qtext_load_file(&qbuffer_size);
+       if (qbuffer == NULL)
+               return;
+
+       /*
+        * We overwrite the query texts file in place, so as to reduce the risk of
+        * an out-of-disk-space failure.  Since the file is guaranteed not to get
+        * larger, this should always work on traditional filesystems; though we
+        * could still lose on copy-on-write filesystems.
+        */
+       qfile = AllocateFile(PGSS_TEXT_FILE, PG_BINARY_W);
+       if (qfile == NULL)
+       {
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                                errmsg("could not write pg_stat_statement file \"%s\": %m",
+                                               PGSS_TEXT_FILE)));
+               goto gc_fail;
+       }
+
+       extent = 0;
+       nentries = 0;
+
+       hash_seq_init(&hash_seq, pgss_hash);
+       while ((entry = hash_seq_search(&hash_seq)) != NULL)
+       {
+               int                     query_len = entry->query_len;
+               char       *qry = qtext_fetch(entry->query_offset,
+                                                                         query_len,
+                                                                         qbuffer,
+                                                                         qbuffer_size);
+
+               if (qry == NULL)
+               {
+                       /* Trouble ... drop the text */
+                       entry->query_offset = 0;
+                       entry->query_len = -1;
+                       continue;
+               }
+
+               if (fwrite(qry, 1, query_len + 1, qfile) != query_len + 1)
+               {
+                       ereport(LOG,
+                                       (errcode_for_file_access(),
+                                 errmsg("could not write pg_stat_statement file \"%s\": %m",
+                                                PGSS_TEXT_FILE)));
+                       hash_seq_term(&hash_seq);
+                       goto gc_fail;
+               }
+
+               entry->query_offset = extent;
+               extent += query_len + 1;
+               nentries++;
+       }
+
+       /*
+        * Truncate away any now-unused space.  If this fails for some odd reason,
+        * we log it, but there's no need to fail.
+        */
+       if (ftruncate(fileno(qfile), extent) != 0)
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                          errmsg("could not truncate pg_stat_statement file \"%s\": %m",
+                                         PGSS_TEXT_FILE)));
+
+       if (FreeFile(qfile))
+       {
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                                errmsg("could not write pg_stat_statement file \"%s\": %m",
+                                               PGSS_TEXT_FILE)));
+               qfile = NULL;
+               goto gc_fail;
+       }
+
+       elog(DEBUG1, "pgss gc of queries file shrunk size from %zu to %zu",
+                pgss->extent, extent);
+
+       /* Reset the shared extent pointer */
+       pgss->extent = extent;
+
+       /*
+        * Also update the mean query length, to be sure that need_gc_qtexts()
+        * won't still think we have a problem.
+        */
+       if (nentries > 0)
+               pgss->mean_query_len = extent / nentries;
+       else
+               pgss->mean_query_len = ASSUMED_LENGTH_INIT;
+
+       free(qbuffer);
+
+       /*
+        * OK, count a garbage collection cycle.  (Note: even though we have
+        * exclusive lock on pgss->lock, we must take pgss->mutex for this, since
+        * other processes may examine gc_count while holding only the mutex.
+        * Also, we have to advance the count *after* we've rewritten the file,
+        * else other processes might not realize they read a stale file.)
+        */
+       record_gc_qtexts();
+
+       return;
+
+gc_fail:
+       /* clean up resources */
+       if (qfile)
+               FreeFile(qfile);
+       if (qbuffer)
+               free(qbuffer);
+
+       /*
+        * Since the contents of the external file are now uncertain, mark all
+        * hashtable entries as having invalid texts.
+        */
+       hash_seq_init(&hash_seq, pgss_hash);
+       while ((entry = hash_seq_search(&hash_seq)) != NULL)
+       {
+               entry->query_offset = 0;
+               entry->query_len = -1;
+       }
+
+       /* Seems like a good idea to bump the GC count even though we failed */
+       record_gc_qtexts();
+}
+
+/*
  * Release all entries.
  */
 static void
@@ -1353,6 +2100,7 @@ entry_reset(void)
 {
        HASH_SEQ_STATUS hash_seq;
        pgssEntry  *entry;
+       FILE       *qfile;
 
        LWLockAcquire(pgss->lock, LW_EXCLUSIVE);
 
@@ -1362,6 +2110,34 @@ entry_reset(void)
                hash_search(pgss_hash, &entry->key, HASH_REMOVE, NULL);
        }
 
+       /*
+        * Write new empty query file, perhaps even creating a new one to recover
+        * if the file was missing.
+        */
+       qfile = AllocateFile(PGSS_TEXT_FILE, PG_BINARY_W);
+       if (qfile == NULL)
+       {
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                                errmsg("could not create pg_stat_statement file \"%s\": %m",
+                                               PGSS_TEXT_FILE)));
+               goto done;
+       }
+
+       /* If ftruncate fails, log it, but it's not a fatal problem */
+       if (ftruncate(fileno(qfile), 0) != 0)
+               ereport(LOG,
+                               (errcode_for_file_access(),
+                          errmsg("could not truncate pg_stat_statement file \"%s\": %m",
+                                         PGSS_TEXT_FILE)));
+
+       FreeFile(qfile);
+
+done:
+       pgss->extent = 0;
+       /* This counts as a query text garbage collection for our purposes */
+       record_gc_qtexts();
+
        LWLockRelease(pgss->lock);
 }
 #endif
@@ -1469,7 +2245,7 @@ JumbleRangeTable(pgssJumbleState *jstate, List *rtable)
                                APP_JUMB(rte->jointype);
                                break;
                        case RTE_FUNCTION:
-                               JumbleExpr(jstate, rte->funcexpr);
+                               JumbleExpr(jstate, (Node *) rte->functions);
                                break;
                        case RTE_VALUES:
                                JumbleExpr(jstate, (Node *) rte->values_lists);
@@ -1501,7 +2277,7 @@ JumbleRangeTable(pgssJumbleState *jstate, List *rtable)
  *
  * Note: the reason we don't simply use expression_tree_walker() is that the
  * point of that function is to support tree walkers that don't care about
- * most tree node types, but here we care about all types.     We should complain
+ * most tree node types, but here we care about all types.  We should complain
  * about any unrecognized node type.
  */
 static void
@@ -1556,9 +2332,11 @@ JumbleExpr(pgssJumbleState *jstate, Node *node)
                                Aggref     *expr = (Aggref *) node;
 
                                APP_JUMB(expr->aggfnoid);
+                               JumbleExpr(jstate, (Node *) expr->aggdirectargs);
                                JumbleExpr(jstate, (Node *) expr->args);
                                JumbleExpr(jstate, (Node *) expr->aggorder);
                                JumbleExpr(jstate, (Node *) expr->aggdistinct);
+                               JumbleExpr(jstate, (Node *) expr->aggfilter);
                        }
                        break;
                case T_WindowFunc:
@@ -1568,6 +2346,7 @@ JumbleExpr(pgssJumbleState *jstate, Node *node)
                                APP_JUMB(expr->winfnoid);
                                APP_JUMB(expr->winref);
                                JumbleExpr(jstate, (Node *) expr->args);
+                               JumbleExpr(jstate, (Node *) expr->aggfilter);
                        }
                        break;
                case T_ArrayRef:
@@ -1877,6 +2656,13 @@ JumbleExpr(pgssJumbleState *jstate, Node *node)
                                JumbleExpr(jstate, setop->rarg);
                        }
                        break;
+               case T_RangeTblFunction:
+                       {
+                               RangeTblFunction *rtfunc = (RangeTblFunction *) node;
+
+                               JumbleExpr(jstate, rtfunc->funcexpr);
+                       }
+                       break;
                default:
                        /* Only a warning, since we can stumble along anyway */
                        elog(WARNING, "unrecognized node type: %d",
@@ -1922,7 +2708,7 @@ RecordConstLocation(pgssJumbleState *jstate, int location)
  * *query_len_p contains the input string length, and is updated with
  * the result string length (which cannot be longer) on exit.
  *
- * Returns a palloc'd string, which is not necessarily null-terminated.
+ * Returns a palloc'd string.
  */
 static char *
 generate_normalized_query(pgssJumbleState *jstate, const char *query,
@@ -1930,7 +2716,6 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query,
 {
        char       *norm_query;
        int                     query_len = *query_len_p;
-       int                     max_output_len;
        int                     i,
                                len_to_wrt,             /* Length (in bytes) to write */
                                quer_loc = 0,   /* Source query byte location */
@@ -1944,13 +2729,8 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query,
         */
        fill_in_constant_lengths(jstate, query);
 
-       /* Allocate result buffer, ensuring we limit result to allowed size */
-#ifdef NOT_USED
-       max_output_len = Min(query_len, pgss->query_size - 1);
-#endif
-       /* XXX: pg_hint_plan doesn't truncate query string. */
-       max_output_len = query_len;
-       norm_query = palloc(max_output_len);
+       /* Allocate result buffer */
+       norm_query = palloc(query_len + 1);
 
        for (i = 0; i < jstate->clocations_count; i++)
        {
@@ -1963,55 +2743,36 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query,
                if (tok_len < 0)
                        continue;                       /* ignore any duplicates */
 
-               /* Copy next chunk, or as much as will fit */
+               /* Copy next chunk (what precedes the next constant) */
                len_to_wrt = off - last_off;
                len_to_wrt -= last_tok_len;
-               len_to_wrt = Min(len_to_wrt, max_output_len - n_quer_loc);
 
                Assert(len_to_wrt >= 0);
                memcpy(norm_query + n_quer_loc, query + quer_loc, len_to_wrt);
                n_quer_loc += len_to_wrt;
 
-               if (n_quer_loc < max_output_len)
-                       norm_query[n_quer_loc++] = '?';
+               /* And insert a '?' in place of the constant token */
+               norm_query[n_quer_loc++] = '?';
 
                quer_loc = off + tok_len;
                last_off = off;
                last_tok_len = tok_len;
-
-               /* If we run out of space, might as well stop iterating */
-               if (n_quer_loc >= max_output_len)
-                       break;
        }
 
        /*
         * We've copied up until the last ignorable constant.  Copy over the
-        * remaining bytes of the original query string, or at least as much as
-        * will fit.
+        * remaining bytes of the original query string.
         */
        len_to_wrt = query_len - quer_loc;
-       len_to_wrt = Min(len_to_wrt, max_output_len - n_quer_loc);
 
        Assert(len_to_wrt >= 0);
        memcpy(norm_query + n_quer_loc, query + quer_loc, len_to_wrt);
        n_quer_loc += len_to_wrt;
 
-       /* XXX: pg_hint_plan doesn't truncate query string. */
-#ifdef NOT_USED
-       /*
-        * If we ran out of space, we need to do an encoding-aware truncation,
-        * just to make sure we don't have an incomplete character at the end.
-        */
-       if (n_quer_loc >= max_output_len)
-               query_len = pg_encoding_mbcliplen(encoding,
-                                                                                 norm_query,
-                                                                                 n_quer_loc,
-                                                                                 pgss->query_size - 1);
-       else
-#endif
-               query_len = n_quer_loc;
+       Assert(n_quer_loc <= query_len);
+       norm_query[n_quer_loc] = '\0';
 
-       *query_len_p = query_len;
+       *query_len_p = n_quer_loc;
        return norm_query;
 }
 
@@ -2030,7 +2791,7 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query,
  * a problem.
  *
  * Duplicate constant pointers are possible, and will have their lengths
- * marked as '-1', so that they are later ignored.     (Actually, we assume the
+ * marked as '-1', so that they are later ignored.  (Actually, we assume the
  * lengths were initialized as -1 to start with, and don't change them here.)
  *
  * N.B. There is an assumption that a '-' character at a Const location begins
@@ -2099,7 +2860,7 @@ fill_in_constant_lengths(pgssJumbleState *jstate, const char *query)
                                         * adjustment of location to that of the leading '-'
                                         * operator in the event of a negative constant.  It is
                                         * also useful for our purposes to start from the minus
-                                        * symbol.      In this way, queries like "select * from foo
+                                        * symbol.  In this way, queries like "select * from foo
                                         * where bar = 1" and "select * from foo where bar = -2"
                                         * will have identical normalized query strings.
                                         */
@@ -2143,4 +2904,3 @@ comp_location(const void *a, const void *b)
        else
                return 0;
 }
-
index b33f065..632f13a 100644 (file)
@@ -118,6 +118,12 @@ CREATE VIEW v4 AS SELECT v_2.t1_id, t_3.id FROM v2 v_2, t3 t_3 WHERE v_2.t1_id =
  * The following GUC parameters need the setting of the default value to
  * succeed in regression test.
  */
+
+/* Fix auto-tunable parameters */
+ALTER SYSTEM SET effective_cache_size TO 16384;
+\! pg_ctl reload
+SET effective_cache_size TO 16384;
+
 CREATE VIEW settings AS
 SELECT name, setting, category
   FROM pg_settings
@@ -125,3 +131,5 @@ SELECT name, setting, category
     OR name = 'client_min_messages'
  ORDER BY category, name;
 SELECT * FROM settings;
+
+ANALYZE;
\ No newline at end of file
diff --git a/sql/maskout.sh b/sql/maskout.sh
new file mode 100755 (executable)
index 0000000..d0e0623
--- /dev/null
@@ -0,0 +1,4 @@
+#! /bin/sh
+cat $1 | \
+sed 's/cost=[\.0-9]*/cost=xxx/;s/width=[0-9]*/width=xxx/' |\
+grep -v "Planning time:"
index 39cb717..ecb7091 100644 (file)
@@ -1,11 +1,11 @@
 SET search_path TO public;
+SET client_min_messages TO log;
 
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
 
 LOAD 'pg_hint_plan';
 SET pg_hint_plan.debug_print TO on;
-SET client_min_messages TO LOG;
 
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.id = t2.id;
 EXPLAIN (COSTS false) SELECT * FROM t1, t2 WHERE t1.val = t2.val;
@@ -849,28 +849,80 @@ DROP EXTENSION pg_hint_plan;
 --
 -- Rows hint tests
 --
+-- Explain result includes "Planning time" if COSTS is enabled, but
+-- this test needs it enabled for get rows count. So do tests via psql
+-- and grep -v the mutable line.
+
 -- value types
+\o results/pg_hint_plan.tmpout
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 +99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 -99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 *99) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 *0.01) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #aa) */
-EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);    -- ERROR
+EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 /99) */
-EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);    -- ERROR
+EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id); -- ERROR
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
 -- round up to 1
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 -99999) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
 -- complex join tree
+\o results/pg_hint_plan.tmpout
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t2 #22) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+
+\o results/pg_hint_plan.tmpout
 /*+ Rows(t1 t3 *10) */
 EXPLAIN SELECT * FROM t1 JOIN t2 ON (t1.id = t2.id) JOIN t3 ON (t3.id = t2.id);
+\o
+\! sql/maskout.sh results/pg_hint_plan.tmpout
+\! rm results/pg_hint_plan.tmpout
index c9800b2..42cf982 100644 (file)
@@ -511,51 +511,52 @@ EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 ----
 ---- No. A-8-1 original GUC parameter
 ----
-
+---- Don't test postgresql itself.
 -- No. A-8-1-1
-SET ROLE super_user;
-SET pg_hint_plan.debug_print TO off;
-SHOW pg_hint_plan.enable_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-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_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-RESET pg_hint_plan.enable_hint;
-RESET pg_hint_plan.debug_print;
-RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-
--- No. A-8-1-2
-SET ROLE normal_user;
-SHOW pg_hint_plan.enable_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-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_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-RESET pg_hint_plan.enable_hint;
-RESET pg_hint_plan.debug_print;
-RESET pg_hint_plan.parse_messages;
-SHOW pg_hint_plan.enable_hint;
-SHOW pg_hint_plan.debug_print;
-SHOW pg_hint_plan.parse_messages;
-
-RESET ROLE;
+-- SET ROLE super_user;
+-- SET pg_hint_plan.debug_print TO off;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 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_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- RESET pg_hint_plan.enable_hint;
+-- RESET pg_hint_plan.debug_print;
+-- RESET pg_hint_plan.parse_messages;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 
+-- -- No. A-8-1-2
+-- SET ROLE normal_user;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 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_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- RESET pg_hint_plan.enable_hint;
+-- RESET pg_hint_plan.debug_print;
+-- RESET pg_hint_plan.parse_messages;
+-- SHOW pg_hint_plan.enable_hint;
+-- SHOW pg_hint_plan.debug_print;
+-- SHOW pg_hint_plan.parse_messages;
+-- 
+-- RESET ROLE;
 
 ----
 ---- No. A-8-2 original GUC parameter pg_hint_plan.enable_hint
 ----
 
 -- No. A-8-2-1
+SET pg_hint_plan.debug_print TO off;
 SET pg_hint_plan.enable_hint TO on;
 SHOW pg_hint_plan.enable_hint;
 /*+Set(enable_indexscan off)*/
@@ -568,20 +569,24 @@ SHOW pg_hint_plan.enable_hint;
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 
 -- No. A-8-2-3
-SET pg_hint_plan.enable_hint TO DEFAULT;
-SHOW pg_hint_plan.enable_hint;
-/*+Set(enable_indexscan off)*/
-EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+-- Don't test PostgreSQL itself.
+-- SET pg_hint_plan.enable_hint TO DEFAULT;
+-- SHOW pg_hint_plan.enable_hint;
+-- /*+Set(enable_indexscan off)*/
+-- EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
 
 -- No. A-8-2-4
-SET pg_hint_plan.enable_hint TO enable;
-SHOW pg_hint_plan.enable_hint;
+-- Don't test PostgreSQL itself
+-- SET pg_hint_plan.enable_hint TO enable;
+-- SHOW pg_hint_plan.enable_hint;
 
 ----
 ---- No. A-8-3 original GUC parameter pg_hint_plan.debug_print
 ----
 
 -- No. A-8-3-1
+SET pg_hint_plan.enable_hint TO on;
+SHOW pg_hint_plan.enable_hint;
 SET pg_hint_plan.debug_print TO on;
 SHOW pg_hint_plan.debug_print;
 /*+Set(enable_indexscan off)*/
index 7531415..7a9e0b8 100644 (file)
@@ -150,8 +150,13 @@ EXPLAIN (COSTS false) SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
 
 -- No. J-1-6-11
 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+
+\o results/ut-J.tmpout
 /*+MergeJoin(t1 t2)NestLoop(st1 st2)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+\o
+\! sql/maskout.sh results/ut-J.tmpout
+
 --
 -- There are cases where difference in the measured value and predicted value
 -- depending upon the version of PostgreSQL
@@ -806,5 +811,9 @@ SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE false;
 ----
 -- No. J-3-5-1
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+\o results/ut-J.tmpout
 /*+NestLoop(t1 t2)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1 FULL OUTER JOIN s1.t2 ON (t1.c1 = t2.c1);
+\o
+\! sql/maskout.sh results/ut-J.tmpout
+\! rm results/ut-J.tmpout
index 0acfbf9..0135611 100644 (file)
@@ -4,295 +4,357 @@ SET pg_hint_plan.debug_print TO on;
 SET client_min_messages TO LOG;
 SET search_path TO public;
 
-\o results/R_sample.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_sample.out.log > results/R_sample.out
-\! diff expected/R_sample.out results/R_sample.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-1 specified pattern of the object name
 ----
 
 -- No. R-1-1-1
-\o results/R_1-1-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-1.out.log > results/R_1-1-1.out
-\! diff expected/R_1-1-1.out results/R_1-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-1-2
-\o results/R_1-1-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-2.out.log > results/R_1-1-2.out
-\! diff expected/R_1-1-2.out results/R_1-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-1-3
-\o results/R_1-1-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t_1 t_2 #1)*/
 EXPLAIN SELECT * FROM s1.t1 t_1, s1.t2 t_2 WHERE t_1.c1 = t_2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-1-3.out.log > results/R_1-1-3.out
-\! diff expected/R_1-1-3.out results/R_1-1-3.out
-
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-2 specified schema name in the hint option
 ----
 
 -- No. R-1-2-1
-\o results/R_1-2-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-2-1.out.log > results/R_1-2-1.out
-\! diff expected/R_1-2-1.out results/R_1-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-2-2
-\o results/R_1-2-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(s1.t1 s1.t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-2-2.out.log > results/R_1-2-2.out
-\! diff expected/R_1-2-2.out results/R_1-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-3 table doesn't exist in the hint option
 ----
 
 -- No. R-1-3-1
-\o results/R_1-3-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-3-1.out.log > results/R_1-3-1.out
-\! diff expected/R_1-3-1.out results/R_1-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-3-2
-\o results/R_1-3-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t3 t4 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-3-2.out.log > results/R_1-3-2.out
-\! diff expected/R_1-3-2.out results/R_1-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-4 conflict table name
 ----
 
 -- No. R-1-4-1
-\o results/R_1-4-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-1.out.log > results/R_1-4-1.out
-\! diff expected/R_1-4-1.out results/R_1-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+
 
 -- No. R-1-4-2
-\o results/R_1-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(s1.t1 s2.t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 WHERE s1.t1.c1 = s2.t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
 
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 s2t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s2.t1 s2t1 WHERE s1.t1.c1 = s2t1.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-2.out.log > results/R_1-4-2.out
-\! diff expected/R_1-4-2.out results/R_1-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-4-3
-\o results/R_1-4-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT *, (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(st1 st2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT *, (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-4-3.out.log > results/R_1-4-3.out
-\! diff expected/R_1-4-3.out results/R_1-4-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-5 conflict table name
 ----
 
 -- No. R-1-5-1
-\o results/R_1-5-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-1.out.log > results/R_1-5-1.out
-\! diff expected/R_1-5-1.out results/R_1-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-5-2
-\o results/R_1-5-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-2.out.log > results/R_1-5-2.out
-\! diff expected/R_1-5-2.out results/R_1-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-5-3
-\o results/R_1-5-3.out.log
+\o results/ut-R.tmpout
 /*+(t1 t1)(t2 t2)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2, s1.t3 WHERE t1.c1 = t2.c1 AND t1.c1 = t3.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+(t1 t2 t1 t2)*/
 EXPLAIN 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;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-5-3.out.log > results/R_1-5-3.out
-\! diff expected/R_1-5-3.out results/R_1-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-1-6 object type for the hint
 ----
 
 -- No. R-1-6-1
-\o results/R_1-6-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-1.out.log > results/R_1-6-1.out
-\! diff expected/R_1-6-1.out results/R_1-6-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-2
-\o results/R_1-6-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.p1 t1, s1.p1 t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-2.out.log > results/R_1-6-2.out
-\! diff expected/R_1-6-2.out results/R_1-6-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-3
-\o results/R_1-6-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.ul1 t1, s1.ul1 t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-3.out.log > results/R_1-6-3.out
-\! diff expected/R_1-6-3.out results/R_1-6-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-4
 CREATE TEMP TABLE tm1 (LIKE s1.t1 INCLUDING ALL);
-\o results/R_1-6-4.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM tm1 t1, tm1 t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-4.out.log > results/R_1-6-4.out
-\! diff expected/R_1-6-4.out results/R_1-6-4.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-5
-\o results/R_1-6-5.out.log
-EXPLAIN SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+CREATE TEMP TABLE t_pg_class WITH OIDS AS SELECT * from pg_class LIMIT 100;
+\o results/ut-R.tmpout
+EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
-EXPLAIN SELECT * FROM pg_catalog.pg_class t1, pg_catalog.pg_class t2 WHERE t1.oid = t2.oid;
+EXPLAIN SELECT * FROM t_pg_class t1, t_pg_class t2 WHERE t1.oid = t2.oid;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-5.out.log > results/R_1-6-5.out
-\! diff expected/R_1-6-5.out results/R_1-6-5.out
+\! sql/maskout.sh results/ut-R.tmpout
+
 
 -- No. R-1-6-6
 -- refer ut-fdw.sql
 
 -- No. R-1-6-7
-\o results/R_1-6-7.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.f1() t1, s1.f1() t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-7.out.log > results/R_1-6-7.out
-\! diff expected/R_1-6-7.out results/R_1-6-7.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-8
-\o results/R_1-6-8.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(*VALUES* t2 #1)*/
 EXPLAIN SELECT * FROM (VALUES(1,1,1,'1'), (2,2,2,'2'), (3,3,3,'3')) AS t1 (c1, c2, c3, c4),  s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-8.out.log > results/R_1-6-8.out
-\! diff expected/R_1-6-8.out results/R_1-6-8.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-9
-\o results/R_1-6-9.out.log
+\o results/ut-R.tmpout
 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 c1 +1)*/
 EXPLAIN WITH c1(c1) AS (SELECT max(t1.c1) FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1) SELECT * FROM s1.t1, c1 WHERE t1.c1 = c1.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-9.out.log > results/R_1-6-9.out
-\! diff expected/R_1-6-9.out results/R_1-6-9.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-10
-\o results/R_1-6-10.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(v1t1 v1t1_ #1)*/
 EXPLAIN SELECT * FROM s1.v1 t1, s1.v1_ t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-10.out.log > results/R_1-6-10.out
-\! diff expected/R_1-6-10.out results/R_1-6-10.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-6-11
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(st1 st2 #1)*/
 EXPLAIN (COSTS true) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1 AND t1.c1 = (SELECT max(st1.c1) FROM s1.t1 st1, s1.t2 st2 WHERE st1.c1 = st2.c1);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
 --
 -- There are cases where difference in the measured value and predicted value
 -- depending upon the version of PostgreSQL
 --
 
-\o results/R_1-6-11.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 st2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, (SELECT t2.c1 FROM s1.t2) st2 WHERE t1.c1 = st2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-6-11.out.log > results/R_1-6-11.out
-\! diff expected/R_1-6-11.out results/R_1-6-11.out
+\! sql/maskout.sh results/ut-R.tmpout
+
 
 ----
 ---- No. R-1-7 specified number of conditions
 ----
 
 -- No. R-1-7-1
-\o results/R_1-7-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-1.out.log > results/R_1-7-1.out
-\! diff expected/R_1-7-1.out results/R_1-7-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-7-2
-\o results/R_1-7-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-2.out.log > results/R_1-7-2.out
-\! diff expected/R_1-7-2.out results/R_1-7-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-1-7-3
-\o results/R_1-7-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #notrows)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_1-7-3.out.log > results/R_1-7-3.out
-\! diff expected/R_1-7-3.out results/R_1-7-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-2-1 some complexity query blocks
 ----
 
 -- No. R-2-1-1
-\o results/R_2-1-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -309,6 +371,10 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
 )
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 ;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -328,11 +394,10 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 ;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-1.out.log > results/R_2-1-1.out
-\! diff expected/R_2-1-1.out results/R_2-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-2
-\o results/R_2-1-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -353,6 +418,10 @@ SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3
 )
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 ;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -378,41 +447,46 @@ SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 ;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-2.out.log > results/R_2-1-2.out
-\! diff expected/R_2-1-2.out results/R_2-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-3
-\o results/R_2-1-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 */
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
 */
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-3.out.log > results/R_2-1-3.out
-\! diff expected/R_2-1-3.out results/R_2-1-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-4
-\o results/R_2-1-4.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 */
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 #1)Rows(bmt4 bmt3 bmt2 #1)Rows(bmt1 bmt2 bmt3 bmt4 #1)
 */
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-4.out.log > results/R_2-1-4.out
-\! diff expected/R_2-1-4.out results/R_2-1-4.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-5
-\o results/R_2-1-5.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -427,8 +501,11 @@ AND bmt1.c1 <> (
 SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1t1.c1 = b1t2.c1 AND b1t1.c1 = b1t3.c1 AND b1t1.c1 = b1t4.c1
 ) AND bmt1.c1 <> (
 SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1 = b2t2.c1 AND b2t1.c1 = b2t3.c1 AND b2t1.c1 = b2t4.c1
-)
-;
+);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -449,11 +526,10 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
 )
 ;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-5.out.log > results/R_2-1-5.out
-\! diff expected/R_2-1-5.out results/R_2-1-5.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-6
-\o results/R_2-1-6.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -474,6 +550,10 @@ SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2
 SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
 )
 ;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -499,11 +579,10 @@ SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3
 )
 ;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-6.out.log > results/R_2-1-6.out
-\! diff expected/R_2-1-6.out results/R_2-1-6.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-7
-\o results/R_2-1-7.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -525,6 +604,10 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 = c2.c1
 ;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -547,14 +630,12 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
 , c1, c2
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
-AND bmt1.c1 = c2.c1
-;
+AND bmt1.c1 = c2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-7.out.log > results/R_2-1-7.out
-\! diff expected/R_2-1-7.out results/R_2-1-7.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-1-8
-\o results/R_2-1-8.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -580,8 +661,11 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 = c2.c1
-AND bmt1.c1 = c3.c1
-;
+AND bmt1.c1 = c3.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c3 c2 c1 bmt1 bmt2 bmt3 bmt4)
 Leading(b1t2 b1t3 b1t4 b1t1)
@@ -611,18 +695,16 @@ SELECT max(bmt1.c1) FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4
                                                                         WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 = c2.c1
-AND bmt1.c1 = c3.c1
-;
+AND bmt1.c1 = c3.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-1-8.out.log > results/R_2-1-8.out
-\! diff expected/R_2-1-8.out results/R_2-1-8.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-2-2 the number of the tables per quiry block
 ----
 
 -- No. R-2-2-1
-\o results/R_2-2-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt1)
 */
@@ -637,8 +719,11 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
-)
-;
+);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt1)
 Rows(bmt1 c1 #1)
@@ -657,14 +742,12 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1 WHERE b3t1.c1 = 1
-)
-;
+);
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-1.out.log > results/R_2-2-1.out
-\! diff expected/R_2-2-1.out results/R_2-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-2-2
-\o results/R_2-2-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt2 bmt1)
 Leading(b1t2 b1t1)
@@ -687,8 +770,11 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2 WHERE b2t1.c1 = b2t2.c1
 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
-)
-;
+);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt2 bmt1)
 Leading(b1t2 b1t1)
@@ -719,11 +805,10 @@ SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2 WHERE b3t1.c1 = b3t2.c1
 )
 ;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-2.out.log > results/R_2-2-2.out
-\! diff expected/R_2-2-2.out results/R_2-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-2-3
-\o results/R_2-2-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1) 
@@ -753,8 +838,11 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
-)
-;
+);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1) 
@@ -797,14 +885,12 @@ SELECT b2t1.c1 FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.c1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.c1 = b3t2.c1 AND b3t1.c1 = b3t3.c1 AND b3t1.c1 = b3t4.c1
-)
-;
+);
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-3.out.log > results/R_2-2-3.out
-\! diff expected/R_2-2-3.out results/R_2-2-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-2-4
-\o results/R_2-2-4.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1)
@@ -826,8 +912,11 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1
-)
-;
+);
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(c1 bmt4 bmt3 bmt2 bmt1)
 Leading(b1t4 b1t3 b1t2 b1t1)
@@ -856,22 +945,24 @@ SELECT b2t1.c1 FROM s1.t1 b2t1 WHERE b2t1.c1 = 1
                     FROM s1.t1 bmt1, s1.t2 bmt2, s1.t3 bmt3, s1.t4 bmt4, c1 WHERE bmt1.c1 = bmt2.c1 AND bmt1.c1 = bmt3.c1 AND bmt1.c1 = bmt4.c1 AND bmt1.c1 = c1.c1
 AND bmt1.c1 <> (
 SELECT b3t1.c1 FROM s1.t1 b3t1
-)
-;
+);
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-2-4.out.log > results/R_2-2-4.out
-\! diff expected/R_2-2-4.out results/R_2-2-4.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-2-3 RULE or VIEW
 ----
 
 -- No. R-2-3-1
-\o results/R_2-3-1.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r1 t1 t2 t3 t4)
 */
 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1 t1 t2 t3 t4)
 Rows(r1 t1 t2 t3 t4 #2)
@@ -880,10 +971,18 @@ Rows(r1 t1 t2 #2)
 Rows(r1 t1 #2)
 */
 EXPLAIN UPDATE s1.r1 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
 */
 EXPLAIN UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r1_ b1t1 b1t2 b1t3 b1t4)
 Rows(r1_ b1t1 b1t2 b1t3 b1t4 #2)
@@ -893,15 +992,18 @@ Rows(r1_ b1t1 #2)
 */
 EXPLAIN UPDATE s1.r1_ SET c1 = c1 WHERE c1 = 1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-1.out.log > results/R_2-3-1.out
-\! diff expected/R_2-3-1.out results/R_2-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-2
-\o results/R_2-3-2.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r2 t1 t2 t3 t4)
 */
 EXPLAIN UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2 t1 t2 t3 t4)
 Rows(r2 t1 t2 t3 t4 #2)
@@ -910,11 +1012,19 @@ Rows(r2 t1 t2 #2)
 Rows(r2 t1 #2)
 */
 EXPLAIN UPDATE s1.r2 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
 */
 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r2_ b1t1 b1t2 b1t3 b1t4)
 Leading(r2_ b2t1 b2t2 b2t3 b2t4)
@@ -929,15 +1039,18 @@ Rows(r2_ b2t1 b2t2 b2t3 b2t4 #2)
 */
 EXPLAIN UPDATE s1.r2_ SET c1 = c1 WHERE c1 = 1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-2.out.log > results/R_2-3-2.out
-\! diff expected/R_2-3-2.out results/R_2-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-3
-\o results/R_2-3-3.out.log
+\o results/ut-R.tmpout
 /*+
 Leading(r3 t1 t2 t3 t4)
 */
 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3 t1 t2 t3 t4)
 Rows(r3 t1 t2 t3 t4 #2)
@@ -946,12 +1059,20 @@ Rows(r3 t1 t2 #2)
 Rows(r3 t1 #2)
 */
 EXPLAIN UPDATE s1.r3 SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
 Leading(r3_ b3t1 b3t2 b3t3 b3t4)
 */
 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(r3_ b1t1 b1t2 b1t3 b1t4)
 Leading(r3_ b2t1 b2t2 b2t3 b2t4)
@@ -971,262 +1092,311 @@ Rows(r3_ b3t1 b3t2 b3t3 b3t4 #2)
 */
 EXPLAIN UPDATE s1.r3_ SET c1 = c1 WHERE c1 = 1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-3.out.log > results/R_2-3-3.out
-\! diff expected/R_2-3-3.out results/R_2-3-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-4
-\o results/R_2-3-4.out.log
+\o results/ut-R.tmpout
 /*+HashJoin(v1t1 v1t1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+HashJoin(v1t1 v1t1)Rows(v1t1 v1t1 #1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1 v2 WHERE v1.c1 = v2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-4.out.log > results/R_2-3-4.out
-\! diff expected/R_2-3-4.out results/R_2-3-4.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-5
-\o results/R_2-3-5.out.log
+\o results/ut-R.tmpout
 /*+NestLoop(v1t1 v1t1_)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+NestLoop(v1t1 v1t1_)Rows(v1t1 v1t1_ #1)*/
 EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-5.out.log > results/R_2-3-5.out
-\! diff expected/R_2-3-5.out results/R_2-3-5.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-6
-\o results/R_2-3-6.out.log
+\o results/ut-R.tmpout
 /*+RowsHashJoin(r4t1 r4t1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-6.out.log > results/R_2-3-6.out
-\! diff expected/R_2-3-6.out results/R_2-3-6.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-3-7
-\o results/R_2-3-7.out.log
+\o results/ut-R.tmpout
 /*+NestLoop(r4t1 r5t1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
 EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-3-7.out.log > results/R_2-3-7.out
-\! diff expected/R_2-3-7.out results/R_2-3-7.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-2-4 VALUES clause
 ----
 
 -- No. R-2-4-1
-\o results/R_2-4-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+ Leading(t3 t1 t2) Rows(t3 t1 #2)Rows(t3 t1 t2 #2)*/
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+ Leading(*VALUES* t1 t2) Rows(*VALUES* t1 #2)Rows(*VALUES* t1 t2 #2)*/
 EXPLAIN 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;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-1.out.log > results/R_2-4-1.out
-\! diff expected/R_2-4-1.out results/R_2-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-4-2
-\o results/R_2-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+ Leading(t4 t3 t2 t1) Rows(t4 t3 #2) Rows(t4 t3 t2 #2)Rows(t4 t3 t2 t1 #2)*/
 EXPLAIN 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;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+ Leading(*VALUES* t3 t2 t1) Rows(t4 t3 #2)Rows(*VALUES* t3 t2 #2)Rows(*VALUES* t3 t2 t1 #2)*/
 EXPLAIN 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;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-4-2.out.log > results/R_2-4-2.out
-\! diff expected/R_2-4-2.out results/R_2-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-2-5
 ----
 
 -- No. R-2-5-1
-\o results/R_2-5-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT max(bmt1.c1) FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt1 bmt2 bmt3 bmt4 *0.7)
 */
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-1.out.log > results/R_2-5-1.out
-\! diff expected/R_2-5-1.out results/R_2-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-5-2
-\o results/R_2-5-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt3 *0.6)
 */
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-2.out.log > results/R_2-5-2.out
-\! diff expected/R_2-5-2.out results/R_2-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-2-5-3
-\o results/R_2-5-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+
 Leading(bmt4 bmt3 bmt2 bmt1)
 Rows(bmt4 bmt1 *0.5)
 */
 EXPLAIN SELECT bmt1.c1 FROM s1.t1 bmt1, (SELECT ctid, * FROM s1.t2 bmt2) sbmt2, (SELECT ctid, * FROM s1.t3 bmt3) sbmt3, (SELECT ctid, * FROM s1.t4 bmt4) sbmt4 WHERE bmt1.c1 = sbmt2.c1 AND bmt1.c1 = sbmt3.c1 AND bmt1.c1 = sbmt4.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_2-5-3.out.log > results/R_2-5-3.out
-\! diff expected/R_2-5-3.out results/R_2-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-3-1 abusolute value
 ----
 
 -- No. R-3-1-1
-\o results/R_3-1-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #0)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-1-1.out.log > results/R_3-1-1.out
-\! diff expected/R_3-1-1.out results/R_3-1-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-1-2
-\o results/R_3-1-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #5)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-1-2.out.log > results/R_3-1-2.out
-\! diff expected/R_3-1-2.out results/R_3-1-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-3-2 increase or decrease value
 ----
 
 -- No. R-3-2-1
-\o results/R_3-2-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 +1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-1.out.log > results/R_3-2-1.out
-\! diff expected/R_3-2-1.out results/R_3-2-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-2-2
-\o results/R_3-2-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 -1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-2.out.log > results/R_3-2-2.out
-\! diff expected/R_3-2-2.out results/R_3-2-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-2-3
-\o results/R_3-2-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 -1000)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-2-3.out.log > results/R_3-2-3.out
-\! diff expected/R_3-2-3.out results/R_3-2-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-3-3 multiple 
 ----
 
 -- No. R-3-3-1
-\o results/R_3-3-1.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *0)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-1.out.log > results/R_3-3-1.out
-\! diff expected/R_3-3-1.out results/R_3-3-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-3-2
-\o results/R_3-3-2.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *2)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-2.out.log > results/R_3-3-2.out
-\! diff expected/R_3-3-2.out results/R_3-3-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-3-3
-\o results/R_3-3-3.out.log
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 *0.1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-3-3.out.log > results/R_3-3-3.out
-\! diff expected/R_3-3-3.out results/R_3-3-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-3-4 join inherit tables
 ----
 
 -- No. R-3-4-1
-\o results/R_3-4-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(p1 p2 #1)*/
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-4-1.out.log > results/R_3-4-1.out
-\! diff expected/R_3-4-1.out results/R_3-4-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-4-2
-\o results/R_3-4-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(p1c1 p2c1 #1)*/
 EXPLAIN SELECT * FROM s1.p1, s1.p2 WHERE p1.c1 = p2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-4-2.out.log > results/R_3-4-2.out
-\! diff expected/R_3-4-2.out results/R_3-4-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 ----
 ---- No. R-3-5 conflict join method hint
 ----
 
 -- No. R-3-5-1
-\o results/R_3-5-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-1.out.log > results/R_3-5-1.out
-\! diff expected/R_3-5-1.out results/R_3-5-1.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-5-2
-\o results/R_3-5-2.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t1 t2 #1)Rows(t1 t2 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-2.out.log > results/R_3-5-2.out
-\! diff expected/R_3-5-2.out results/R_3-5-2.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-5-3
-\o results/R_3-5-3.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 #1)Rows(t2 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-3.out.log > results/R_3-5-3.out
-\! diff expected/R_3-5-3.out results/R_3-5-3.out
+\! sql/maskout.sh results/ut-R.tmpout
 
 -- No. R-3-5-4
-\o results/R_3-5-4.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t2 t1 #1)Rows(t1 t2 #1)Rows(t2 t1 #1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-5-4.out.log > results/R_3-5-4.out
-\! diff expected/R_3-5-4.out results/R_3-5-4.out
+\! sql/maskout.sh results/ut-R.tmpout
+
 ----
 ---- No. R-3-6 hint state output
 ----
 
 -- No. R-3-6-1
 SET client_min_messages TO DEBUG1;
-\o results/R_3-6-1.out.log
+\o results/ut-R.tmpout
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
+\o
+\! sql/maskout.sh results/ut-R.tmpout
+
+\o results/ut-R.tmpout
 /*+Rows(t1 t2 +1)*/
 EXPLAIN SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
 \o
-\! sed 's/cost=[\.0-9]*/cost=xxx/' results/R_3-6-1.out.log > results/R_3-6-1.out
-\! diff expected/R_3-6-1.out results/R_3-6-1.out
+\! sql/maskout.sh results/ut-R.tmpout
+\! rm results/ut-R.tmpout
index 1c6475a..315d16c 100644 (file)
@@ -1,4 +1,9 @@
 LOAD 'pg_hint_plan';
+-- We cannot do ALTER USER current_user SET ...
+DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user);
+INSERT INTO pg_db_role_setting (SELECT 0, (SELECT oid FROM pg_roles WHERE rolname = current_user), '{client_min_messages=log,pg_hint_plan.debug_print=on}');
+ALTER SYSTEM SET session_preload_libraries TO 'pg_hint_plan';
+\! pg_ctl reload
 SET pg_hint_plan.enable_hint TO on;
 SET pg_hint_plan.debug_print TO on;
 SET client_min_messages TO LOG;
@@ -800,33 +805,26 @@ EXPLAIN (COSTS false) SELECT c2 FROM s1.ti1 WHERE c2 >= 1;
 ----
 
 -- No. S-3-5-1
-/*+IndexScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-2
-/*+BitmapScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+BitmapScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-3
-/*+IndexOnlyScan(ti1 ti1_pred)*/
-EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 ti1_pred)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-4
-/*+IndexScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-5
-/*+BitmapScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+BitmapScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT * FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-6
-/*+IndexOnlyScan(ti1 not_exist)*/
-EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100;
+\! psql contrib_regression -c "/*+IndexOnlyScan(ti1 not_exist)*/ EXPLAIN (COSTS true) SELECT c1 FROM s1.ti1 WHERE c1 = 100" | grep -v "Planning time:"
 
 -- No. S-3-5-7
 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
-/*+TidScan(t1)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+\! psql contrib_regression -c "/*+TidScan(t1)*/ EXPLAIN (COSTS true) SELECT * FROM s1.t1 WHERE t1.c1 = 1" | grep -v "Planning time:"
 
 ----
 ---- No. S-3-6 query structure
@@ -949,17 +947,15 @@ EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
 EXPLAIN (COSTS false) SELECT * FROM s1.p2 WHERE c1 = 1;
 
 -- No. S-3-10-3
-EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10;
-/*+IndexScan(p1 p1_parent)*/
-EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10;
+\! psql contrib_regression -c "EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10" | grep -v "Planning time:"
+\! psql contrib_regression -c "/*+IndexScan(p1 p1_parent)*/ EXPLAIN SELECT c4 FROM s1.p1 WHERE c2 * 2 < 100 AND c1 < 10" | grep -v "Planning time:"
 
 -- No. S-3-10-4
-/*+IndexScan(p1 p1_i2)*/
-EXPLAIN SELECT c2 FROM s1.p1 WHERE c2 = 1;
+
+\! psql contrib_regression -c "/*+IndexScan(p1 p1_i2)*/ EXPLAIN SELECT c2 FROM s1.p1 WHERE c2 = 1" | grep -v "Planning time:"
 
 -- No. S-3-10-5
-/*+IndexScan(p2 p2c1_pkey)*/
-EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1;
+\! psql contrib_regression -c "/*+IndexScan(p2 p2c1_pkey)*/ EXPLAIN (COSTS true) SELECT * FROM s1.p2 WHERE c1 = 1" | grep -v "Planning time:"
 
 ----
 ---- No. S-3-12 specified same table
@@ -1154,3 +1150,8 @@ EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1;
 -- No. S-3-15-5
 /*+IndexScan(ti1 not_exist1 not_exist2)*/
 EXPLAIN (COSTS false) SELECT * FROM s1.ti1 WHERE c2 = 1;
+
+DELETE FROM pg_db_role_setting WHERE setrole = (SELECT oid FROM pg_roles WHERE rolname = current_user);
+
+ALTER SYSTEM SET session_preload_libraries TO DEFAULT;
+\! pg_ctl reload