OSDN Git Service

単体試験のうち、PostgreSQLのリグレッションテスト機構を使用して
authorMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Fri, 3 Aug 2012 00:54:47 +0000 (09:54 +0900)
committerMitsuru Hasegawa <hasegawa@metrosystems.co.jp>
Fri, 3 Aug 2012 00:54:47 +0000 (09:54 +0900)
実施できる項目を追加した。

Makefile
expected/ut.out [new file with mode: 0644]
expected/ut_fini.out [new file with mode: 0644]
expected/ut_init.out [new file with mode: 0644]
sql/ut.sql [new file with mode: 0644]
sql/ut_fini.sql [new file with mode: 0644]
sql/ut_init.sql [new file with mode: 0644]

index 81080cd..90ce320 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@
 #
 
 MODULES = pg_hint_plan
-REGRESS = init base_plan pg_hint_plan prepare fdw
+REGRESS = init base_plan pg_hint_plan prepare fdw ut_init ut ut_fini
 
 EXTRA_CLEAN = sql/fdw.sql expected/base_plan.out expected/prepare.out expected/fdw.out
 
diff --git a/expected/ut.out b/expected/ut.out
new file mode 100644 (file)
index 0000000..e3b4369
--- /dev/null
@@ -0,0 +1,1155 @@
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+--
+-- No. 5-1 hint format
+--
+-- No. 5-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-2
+/* +SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-3
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-4
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-5
+-- +SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-6
+--SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-7
+/*+SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+INFO:  hint syntax error at or near "/* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
+DETAIL:  Block comments nest doesn't supported.
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-8
+/* +SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-1-9
+/*SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+--
+-- No. 5-2 hint position
+--
+-- No. 5-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t1)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-2-2
+/* normal comment */
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-2-3
+EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+--
+-- No. 5-4 hint delimiter
+--
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+           QUERY PLAN           
+--------------------------------
+ Index Scan using t1_pkey on t1
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-1
+-- No. 5-4-2
+-- No. 5-4-3
+-- No. 5-4-4
+-- No. 5-4-5
+-- No. 5-4-6
+-- No. 5-4-7
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-8
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-9
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-10
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-11
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-12
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-13
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-14
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-15
+/*+    Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-16
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-17
+/*+    Set     (enable_indexscan"off") Set     (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-18
+/*+Set (       enable_indexscan"off")Set       (       enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-19
+/*+Set(enable_indexscan"off"   )       Set(enable_bitmapscan"off"      )       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-20
+/*+Set(        enable_indexscan        "off"   )Set(   enable_bitmapscan       "off"   )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-21
+/*+    Set     (       enable_indexscan        "off"   )       Set     (       enable_bitmapscan       "off"   )       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-22
+/*+
+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-23
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-24
+/*+
+Set
+(enable_indexscan"off")
+Set
+(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-25
+/*+Set
+(
+enable_indexscan"off")Set
+(
+enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-26
+/*+Set(enable_indexscan"off"
+)
+Set(enable_bitmapscan"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-27
+/*+Set(
+enable_indexscan
+"off"
+)Set(
+enable_bitmapscan
+"off"
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-28
+/*+
+Set
+(
+enable_indexscan
+"off"
+)
+Set
+(
+enable_bitmapscan
+"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-29
+/*+    
+        Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-30
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-31
+/*+    
+        Set    
+        (enable_indexscan"off")        
+        Set    
+        (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-32
+/*+Set         
+        (      
+        enable_indexscan"off")Set      
+        (      
+        enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-33
+/*+Set(enable_indexscan"off"   
+        )      
+        Set(enable_bitmapscan"off"     
+        )      
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-34
+/*+Set(        
+        enable_indexscan       
+        "off"  
+        )Set(  
+        enable_bitmapscan      
+        "off"  
+        )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-4-35
+/*+    
+        Set    
+        (      
+        enable_indexscan       
+        "off"  
+        )      
+        Set    
+        (      
+        enable_bitmapscan      
+        "off"  
+        )      
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+Set(enable_bitmapscan off)
+Set(enable_indexscan off)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1
+   Filter: (c1 = 1)
+(2 rows)
+
+--
+-- No. 5-5 hint object pattern
+--
+-- No. 5-5-1
+/*+SeqScan(t)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(t)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 t
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(ttt)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(ttt)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 ttt
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-2
+/*+SeqScan(T)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(T)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 "T"
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(TTT)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(TTT)
+not used hint:
+duplication hint:
+error hint:
+
+      QUERY PLAN      
+----------------------
+ Seq Scan on t1 "TTT"
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-3
+/*+SeqScan(()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(()
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 "("
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(((()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(((()
+not used hint:
+duplication hint:
+error hint:
+
+      QUERY PLAN      
+----------------------
+ Seq Scan on t1 "((("
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+INFO:  hint syntax error at or near "))"
+DETAIL:  ralation name is necessary.
+             QUERY PLAN             
+------------------------------------
+ Index Scan using t1_pkey on t1 ")"
+   Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(")")
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 ")"
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(")))")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(")))")
+not used hint:
+duplication hint:
+error hint:
+
+      QUERY PLAN      
+----------------------
+ Seq Scan on t1 ")))"
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-5
+/*+SeqScan(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+INFO:  hint syntax error at or near ""
+DETAIL:  Unterminated quoted ralation name.
+             QUERY PLAN              
+-------------------------------------
+ Index Scan using t1_pkey on t1 """"
+   Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("""")
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN      
+---------------------
+ Seq Scan on t1 """"
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("""""""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("""""""")
+not used hint:
+duplication hint:
+error hint:
+
+       QUERY PLAN        
+-------------------------
+ Seq Scan on t1 """"""""
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-6
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+INFO:  hint syntax error at or near ")"
+DETAIL:  ralation name is necessary.
+             QUERY PLAN             
+------------------------------------
+ Index Scan using t1_pkey on t1 " "
+   Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(" ")
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 " "
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "   " WHERE "   ".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("   ")
+not used hint:
+duplication hint:
+error hint:
+
+      QUERY PLAN      
+----------------------
+ Seq Scan on t1 "   "
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-7
+/*+SeqScan(    )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "    " WHERE "       ".c1 = 1;
+INFO:  hint syntax error at or near ")"
+DETAIL:  ralation name is necessary.
+                QUERY PLAN                 
+-------------------------------------------
+ Index Scan using t1_pkey on t1 "        "
+   Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "    " WHERE "       ".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("      ")
+not used hint:
+duplication hint:
+error hint:
+
+        QUERY PLAN         
+---------------------------
+ Seq Scan on t1 "        "
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("                   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "                    " WHERE "                       ".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("                      ")
+not used hint:
+duplication hint:
+error hint:
+
+                QUERY PLAN                 
+-------------------------------------------
+ Seq Scan on t1 "                        "
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-8
+/*+SeqScan(
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+INFO:  hint syntax error at or near ")"
+DETAIL:  ralation name is necessary.
+            QUERY PLAN            
+----------------------------------
+ Index Scan using t1_pkey on t1 "
+ "
+   Index Cond: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("
+")
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 "
+ "
+   Filter: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("
+
+
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+
+
+" WHERE "
+
+
+".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("
+
+
+")
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN     
+--------------------
+ Seq Scan on t1 "
+ "
+   Filter: (c1 = 1)
+(5 rows)
+
+-- No. 5-5-9
+/*+SeqScan(Set)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(Set)
+not used hint:
+duplication hint:
+error hint:
+
+      QUERY PLAN      
+----------------------
+ Seq Scan on t1 "Set"
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan("Set SeqScan Leading")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("Set SeqScan Leading")
+not used hint:
+duplication hint:
+error hint:
+
+              QUERY PLAN              
+--------------------------------------
+ Seq Scan on t1 "Set SeqScan Leading"
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-10
+/*+SeqScan(あ)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(あ)
+not used hint:
+duplication hint:
+error hint:
+
+     QUERY PLAN      
+---------------------
+ Seq Scan on t1 "あ"
+   Filter: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(あいう)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan(あいう)
+not used hint:
+duplication hint:
+error hint:
+
+       QUERY PLAN        
+-------------------------
+ Seq Scan on t1 "あいう"
+   Filter: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-11
+/*+SeqScan(/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
+INFO:  hint syntax error at or near "/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;"
+DETAIL:  Block comments nest doesn't supported.
+              QUERY PLAN               
+---------------------------------------
+ Index Scan using t1_pkey on t1 "/**/"
+   Index Cond: (c1 = 1)
+(2 rows)
+
+/*+SeqScan(/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
+INFO:  hint syntax error at or near "/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;"
+DETAIL:  Block comments nest doesn't supported.
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using t1_pkey on t1 "/**//**//**/"
+   Index Cond: (c1 = 1)
+(2 rows)
+
+-- No. 5-5-12
+/*+SeqScan("tT()""     
+Set/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
+Set/**/あ" WHERE "tT()""      
+Set/**/あ".c1 = 1;
+INFO:  hint syntax error at or near "/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
+Set/**/あ" WHERE "tT()""      
+Set/**/あ".c1 = 1;"
+DETAIL:  Block comments nest doesn't supported.
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using t1_pkey on t1 "tT()""  
+ Set/**/あ"
+   Index Cond: (c1 = 1)
+(3 rows)
+
+/*+SeqScan("tT()""     
+Setあ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
+Setあ" WHERE "tT()""  
+Setあ".c1 = 1;
+LOG:  pg_hint_plan:
+used hint:
+SeqScan("tT()""        
+Setあ")
+not used hint:
+duplication hint:
+error hint:
+
+        QUERY PLAN        
+--------------------------
+ Seq Scan on t1 "tT()""  
+ Setあ"
+   Filter: (c1 = 1)
+(3 rows)
+
diff --git a/expected/ut_fini.out b/expected/ut_fini.out
new file mode 100644 (file)
index 0000000..07f8e97
--- /dev/null
@@ -0,0 +1,2 @@
+DROP ROLE IF EXISTS super_user;
+DROP ROLE IF EXISTS normal_user;
diff --git a/expected/ut_init.out b/expected/ut_init.out
new file mode 100644 (file)
index 0000000..4168a9d
--- /dev/null
@@ -0,0 +1,189 @@
+SET search_path TO public;
+CREATE ROLE super_user
+  SUPERUSER
+  NOCREATEDB
+  NOCREATEROLE
+  NOINHERIT
+  NOLOGIN
+  NOREPLICATION
+  CONNECTION LIMIT 1;
+CREATE ROLE normal_user
+  NOSUPERUSER
+  NOCREATEDB
+  NOCREATEROLE
+  NOINHERIT
+  NOLOGIN
+  NOREPLICATION
+  CONNECTION LIMIT 1;
+DROP SCHEMA s1 CASCADE;
+NOTICE:  drop cascades to table s1.t1
+CREATE SCHEMA s1;
+CREATE SCHEMA s2;
+CREATE SCHEMA s3;
+CREATE TABLE s1.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE s1.t2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t2_pkey" for table "t2"
+CREATE TABLE s1.t3 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t3_pkey" for table "t3"
+CREATE TABLE s1.t4 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t4_pkey" for table "t4"
+CREATE TABLE s1.t5 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t5_pkey" for table "t5"
+CREATE TABLE s1.t6 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t6_pkey" for table "t6"
+CREATE TABLE s1.t7 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t7_pkey" for table "t7"
+CREATE TABLE s1.t8 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t8_pkey" for table "t8"
+CREATE TABLE s1.t9 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1), UNIQUE (c4));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t9_pkey" for table "t9"
+NOTICE:  CREATE TABLE / UNIQUE will create implicit index "t9_c4_key" for table "t9"
+CREATE TABLE s2.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE s3.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
+CREATE TABLE s1.p1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p1_pkey" for table "p1"
+CREATE TABLE s1.p2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2_pkey" for table "p2"
+CREATE TABLE s1.p1c1 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p1);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p1c1_pkey" for table "p1c1"
+CREATE TABLE s1.p1c2 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p1);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p1c2_pkey" for table "p1c2"
+CREATE TABLE s1.p1c3 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p1);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p1c3_pkey" for table "p1c3"
+CREATE TABLE s1.p2c1 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p2);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c1_pkey" for table "p2c1"
+CREATE TABLE s1.p2c2 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p2);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c2_pkey" for table "p2c2"
+CREATE TABLE s1.p2c3 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p2);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c3_pkey" for table "p2c3"
+CREATE TABLE s1.p2c1c1 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 <= 50)) INHERITS(s1.p2c1);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c1_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c1c1_pkey" for table "p2c1c1"
+CREATE TABLE s1.p2c1c2 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 > 50 AND c1 <= 100)) INHERITS(s1.p2c1);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c1_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c1c2_pkey" for table "p2c1c2"
+CREATE TABLE s1.p2c2c1 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 150)) INHERITS(s1.p2c2);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c2_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c2c1_pkey" for table "p2c2c1"
+CREATE TABLE s1.p2c2c2 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 150 AND c1 <= 200)) INHERITS(s1.p2c2);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c2_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c2c2_pkey" for table "p2c2c2"
+CREATE TABLE s1.p2c3c1 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 200 AND c1 <= 250)) INHERITS(s1.p2c3);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c3_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c3c1_pkey" for table "p2c3c1"
+CREATE TABLE s1.p2c3c2 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 250)) INHERITS(s1.p2c3);
+NOTICE:  merging column "c1" with inherited definition
+NOTICE:  merging column "c2" with inherited definition
+NOTICE:  merging column "c3" with inherited definition
+NOTICE:  merging column "c4" with inherited definition
+NOTICE:  merging constraint "p2c3_c1_check" with inherited definition
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "p2c3c2_pkey" for table "p2c3c2"
+CREATE TABLE s1.r1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "r1_pkey" for table "r1"
+CREATE TABLE s1.r2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "r2_pkey" for table "r2"
+CREATE TABLE s1.r3 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "r3_pkey" for table "r3"
+INSERT INTO s1.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO s1.t2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t3 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t4 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t5 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t6 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t7 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t8 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t9 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s2.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s3.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO s1.p1c3 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 300) i) t;
+INSERT INTO s1.p2c1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO s1.p2c1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO s1.p2c2c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 150) i) t;
+INSERT INTO s1.p2c2c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(151, 200) i) t;
+INSERT INTO s1.p2c3c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO s1.p2c3c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO s1.r1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.r2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.r3 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+CREATE INDEX t1_i ON s1.t1 (c2);
+CREATE INDEX t2_i ON s1.t2 (c2);
+CREATE INDEX t3_i ON s1.t3 (c2);
+CREATE INDEX t4_i ON s1.t4 (c2);
+CREATE INDEX t5_i ON s1.t5 (c2);
+CREATE INDEX t6_i ON s1.t6 (c2);
+CREATE INDEX t7_i ON s1.t7 (c2);
+CREATE INDEX t8_i ON s1.t8 (c2);
+CREATE INDEX t9_i ON s1.t9 (c2);
+CREATE INDEX t1_i ON s2.t1 (c2);
+CREATE INDEX t1_i ON s3.t1 (c2);
+CREATE INDEX p1_i ON s1.p1 (c2);
+CREATE INDEX p2_i ON s1.p2 (c2);
+CREATE INDEX p1c1_i ON s1.p1c1 (c2);
+CREATE INDEX p1c2_i ON s1.p1c2 (c2);
+CREATE INDEX p1c3_i ON s1.p1c3 (c2);
+CREATE INDEX p2c1_i ON s1.p2c1 (c2);
+CREATE INDEX p2c2_i ON s1.p2c2 (c2);
+CREATE INDEX p2c3_i ON s1.p2c3 (c2);
+CREATE INDEX p2c1c1_i ON s1.p2c1c1 (c2);
+CREATE INDEX p2c1c2_i ON s1.p2c1c2 (c2);
+CREATE INDEX p2c2c1_i ON s1.p2c2c1 (c2);
+CREATE INDEX p2c2c2_i ON s1.p2c2c2 (c2);
+CREATE INDEX p2c3c1_i ON s1.p2c3c1 (c2);
+CREATE INDEX p2c3c2_i ON s1.p2c3c2 (c2);
+CREATE INDEX r1_i ON s1.r1 (c2);
+CREATE INDEX r2_i ON s1.r2 (c2);
+CREATE INDEX r3_i ON s1.r3 (c2);
+CREATE VIEW s1.v1 AS SELECT v1t1.c1, v1t1.c2, v1t1.c3, v1t1.c4 FROM s1.t1 v1t1;
+CREATE VIEW s1.v2 AS SELECT v2t1.c1, v2t1.c2, v2t1.c3, v2t1.c4 FROM s1.t1 v2t1 JOIN s1.t2 v2t2 ON(v2t1.c1 = v2t2.c1);
+CREATE VIEW s1.v3 AS SELECT v3t1.c1, v3t1.c2, v3t1.c3, v3t1.c4 FROM s1.t1 v3t1 JOIN s1.t2 v3t2 ON(v3t1.c1 = v3t2.c1) JOIN s1.t3 v3t3 ON(v3t1.c1 = v3t3.c1);
+ANALYZE;
+\q
diff --git a/sql/ut.sql b/sql/ut.sql
new file mode 100644 (file)
index 0000000..cfccd84
--- /dev/null
@@ -0,0 +1,359 @@
+LOAD 'pg_hint_plan';
+SET pg_hint_plan.enable TO on;
+SET pg_hint_plan.debug_print TO on;
+SET client_min_messages TO LOG;
+SET search_path TO public;
+
+--
+-- No. 5-1 hint format
+--
+
+-- No. 5-1-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-2
+/* +SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-3
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-4
+--+SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-5
+-- +SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-6
+--SeqScan(t1)
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-7
+/*+SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-8
+/* +SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-1-9
+/*SeqScan(t1) /* nest comment */ */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+--
+-- No. 5-2 hint position
+--
+
+-- No. 5-2-1
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-2-2
+/* normal comment */
+/*+SeqScan(t1)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-2-3
+EXPLAIN (COSTS false) SELECT /*+SeqScan(t1)*/ * FROM s1.t1 WHERE t1.c1 = 1;
+
+--
+-- No. 5-4 hint delimiter
+--
+
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+-- No. 5-4-1
+-- No. 5-4-2
+-- No. 5-4-3
+-- No. 5-4-4
+-- No. 5-4-5
+-- No. 5-4-6
+-- No. 5-4-7
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-8
+/*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-9
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-10
+/*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-11
+/*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-12
+/*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-13
+/*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-14
+/*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-15
+/*+    Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-16
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-17
+/*+    Set     (enable_indexscan"off") Set     (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-18
+/*+Set (       enable_indexscan"off")Set       (       enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-19
+/*+Set(enable_indexscan"off"   )       Set(enable_bitmapscan"off"      )       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-20
+/*+Set(        enable_indexscan        "off"   )Set(   enable_bitmapscan       "off"   )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-21
+/*+    Set     (       enable_indexscan        "off"   )       Set     (       enable_bitmapscan       "off"   )       */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-22
+/*+
+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-23
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-24
+/*+
+Set
+(enable_indexscan"off")
+Set
+(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-25
+/*+Set
+(
+enable_indexscan"off")Set
+(
+enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-26
+/*+Set(enable_indexscan"off"
+)
+Set(enable_bitmapscan"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-27
+/*+Set(
+enable_indexscan
+"off"
+)Set(
+enable_bitmapscan
+"off"
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-28
+/*+
+Set
+(
+enable_indexscan
+"off"
+)
+Set
+(
+enable_bitmapscan
+"off"
+)
+*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-29
+/*+    
+        Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-30
+/*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")       
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-31
+/*+    
+        Set    
+        (enable_indexscan"off")        
+        Set    
+        (enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-32
+/*+Set         
+        (      
+        enable_indexscan"off")Set      
+        (      
+        enable_bitmapscan"off")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-33
+/*+Set(enable_indexscan"off"   
+        )      
+        Set(enable_bitmapscan"off"     
+        )      
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-34
+/*+Set(        
+        enable_indexscan       
+        "off"  
+        )Set(  
+        enable_bitmapscan      
+        "off"  
+        )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+-- No. 5-4-35
+/*+    
+        Set    
+        (      
+        enable_indexscan       
+        "off"  
+        )      
+        Set    
+        (      
+        enable_bitmapscan      
+        "off"  
+        )      
+        */
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
+
+--
+-- No. 5-5 hint object pattern
+--
+
+-- No. 5-5-1
+/*+SeqScan(t)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
+/*+SeqScan(ttt)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
+
+-- No. 5-5-2
+/*+SeqScan(T)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
+/*+SeqScan(TTT)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
+
+-- No. 5-5-3
+/*+SeqScan(()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
+/*+SeqScan(((()*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(((" WHERE "(((".c1 = 1;
+
+-- No. 5-5-4
+/*+SeqScan())*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+/*+SeqScan(")")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
+/*+SeqScan(")))")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
+
+-- No. 5-5-5
+/*+SeqScan(")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+/*+SeqScan("""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
+/*+SeqScan("""""""")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
+
+-- No. 5-5-6
+/*+SeqScan( )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan(" ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
+/*+SeqScan("   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "   " WHERE "   ".c1 = 1;
+
+-- No. 5-5-7
+/*+SeqScan(    )*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "    " WHERE "       ".c1 = 1;
+/*+SeqScan("   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "    " WHERE "       ".c1 = 1;
+/*+SeqScan("                   ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "                    " WHERE "                       ".c1 = 1;
+
+-- No. 5-5-8
+/*+SeqScan(
+)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+/*+SeqScan("
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+" WHERE "
+".c1 = 1;
+/*+SeqScan("
+
+
+")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
+
+
+" WHERE "
+
+
+".c1 = 1;
+
+-- No. 5-5-9
+/*+SeqScan(Set)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
+/*+SeqScan("Set SeqScan Leading")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
+
+-- No. 5-5-10
+/*+SeqScan(あ)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
+/*+SeqScan(あいう)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
+
+-- No. 5-5-11
+/*+SeqScan(/**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
+/*+SeqScan(/**//**//**/)*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
+
+-- No. 5-5-12
+/*+SeqScan("tT()""     
+Set/**/あ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
+Set/**/あ" WHERE "tT()""      
+Set/**/あ".c1 = 1;
+
+/*+SeqScan("tT()""     
+Setあ")*/
+EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""      
+Setあ" WHERE "tT()""  
+Setあ".c1 = 1;
+
diff --git a/sql/ut_fini.sql b/sql/ut_fini.sql
new file mode 100644 (file)
index 0000000..07f8e97
--- /dev/null
@@ -0,0 +1,2 @@
+DROP ROLE IF EXISTS super_user;
+DROP ROLE IF EXISTS normal_user;
diff --git a/sql/ut_init.sql b/sql/ut_init.sql
new file mode 100644 (file)
index 0000000..4a92c4d
--- /dev/null
@@ -0,0 +1,116 @@
+SET search_path TO public;
+
+CREATE ROLE super_user
+  SUPERUSER
+  NOCREATEDB
+  NOCREATEROLE
+  NOINHERIT
+  NOLOGIN
+  NOREPLICATION
+  CONNECTION LIMIT 1;
+CREATE ROLE normal_user
+  NOSUPERUSER
+  NOCREATEDB
+  NOCREATEROLE
+  NOINHERIT
+  NOLOGIN
+  NOREPLICATION
+  CONNECTION LIMIT 1;
+
+DROP SCHEMA s1 CASCADE;
+CREATE SCHEMA s1;
+CREATE SCHEMA s2;
+CREATE SCHEMA s3;
+
+CREATE TABLE s1.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t3 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t4 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t5 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t6 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t7 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t8 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.t9 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1), UNIQUE (c4));
+CREATE TABLE s2.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s3.t1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.p1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.p2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.p1c1 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p1);
+CREATE TABLE s1.p1c2 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p1);
+CREATE TABLE s1.p1c3 (LIKE s1.p1 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p1);
+CREATE TABLE s1.p2c1 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 <= 100)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c2 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 200)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c3 (LIKE s1.p2 INCLUDING ALL, CHECK (c1 > 200)) INHERITS(s1.p2);
+CREATE TABLE s1.p2c1c1 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 <= 50)) INHERITS(s1.p2c1);
+CREATE TABLE s1.p2c1c2 (LIKE s1.p2c1 INCLUDING ALL, CHECK (c1 > 50 AND c1 <= 100)) INHERITS(s1.p2c1);
+CREATE TABLE s1.p2c2c1 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 100 AND c1 <= 150)) INHERITS(s1.p2c2);
+CREATE TABLE s1.p2c2c2 (LIKE s1.p2c2 INCLUDING ALL, CHECK (c1 > 150 AND c1 <= 200)) INHERITS(s1.p2c2);
+CREATE TABLE s1.p2c3c1 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 200 AND c1 <= 250)) INHERITS(s1.p2c3);
+CREATE TABLE s1.p2c3c2 (LIKE s1.p2c3 INCLUDING ALL, CHECK (c1 > 250)) INHERITS(s1.p2c3);
+CREATE TABLE s1.r1 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.r2 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+CREATE TABLE s1.r3 (c1 int, c2 int, c3 int, c4 text, PRIMARY KEY (c1));
+
+INSERT INTO s1.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 1000) i) t;
+INSERT INTO s1.t2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t3 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t4 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t5 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t6 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t7 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t8 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.t9 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s2.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s3.t1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.p1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 200) i) t;
+INSERT INTO s1.p1c3 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 300) i) t;
+INSERT INTO s1.p2c1c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 50) i) t;
+INSERT INTO s1.p2c1c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(51, 100) i) t;
+INSERT INTO s1.p2c2c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(101, 150) i) t;
+INSERT INTO s1.p2c2c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(151, 200) i) t;
+INSERT INTO s1.p2c3c1 SELECT i, i, i % 10, i FROM (SELECT generate_series(201, 250) i) t;
+INSERT INTO s1.p2c3c2 SELECT i, i, i % 10, i FROM (SELECT generate_series(251, 300) i) t;
+INSERT INTO s1.r1 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.r2 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+INSERT INTO s1.r3 SELECT i, i, i % 10, i FROM (SELECT generate_series(1, 100) i) t;
+
+CREATE INDEX t1_i ON s1.t1 (c2);
+CREATE INDEX t2_i ON s1.t2 (c2);
+CREATE INDEX t3_i ON s1.t3 (c2);
+CREATE INDEX t4_i ON s1.t4 (c2);
+CREATE INDEX t5_i ON s1.t5 (c2);
+CREATE INDEX t6_i ON s1.t6 (c2);
+CREATE INDEX t7_i ON s1.t7 (c2);
+CREATE INDEX t8_i ON s1.t8 (c2);
+CREATE INDEX t9_i ON s1.t9 (c2);
+CREATE INDEX t1_i ON s2.t1 (c2);
+CREATE INDEX t1_i ON s3.t1 (c2);
+CREATE INDEX p1_i ON s1.p1 (c2);
+CREATE INDEX p2_i ON s1.p2 (c2);
+CREATE INDEX p1c1_i ON s1.p1c1 (c2);
+CREATE INDEX p1c2_i ON s1.p1c2 (c2);
+CREATE INDEX p1c3_i ON s1.p1c3 (c2);
+CREATE INDEX p2c1_i ON s1.p2c1 (c2);
+CREATE INDEX p2c2_i ON s1.p2c2 (c2);
+CREATE INDEX p2c3_i ON s1.p2c3 (c2);
+CREATE INDEX p2c1c1_i ON s1.p2c1c1 (c2);
+CREATE INDEX p2c1c2_i ON s1.p2c1c2 (c2);
+CREATE INDEX p2c2c1_i ON s1.p2c2c1 (c2);
+CREATE INDEX p2c2c2_i ON s1.p2c2c2 (c2);
+CREATE INDEX p2c3c1_i ON s1.p2c3c1 (c2);
+CREATE INDEX p2c3c2_i ON s1.p2c3c2 (c2);
+CREATE INDEX r1_i ON s1.r1 (c2);
+CREATE INDEX r2_i ON s1.r2 (c2);
+CREATE INDEX r3_i ON s1.r3 (c2);
+
+CREATE VIEW s1.v1 AS SELECT v1t1.c1, v1t1.c2, v1t1.c3, v1t1.c4 FROM s1.t1 v1t1;
+CREATE VIEW s1.v2 AS SELECT v2t1.c1, v2t1.c2, v2t1.c3, v2t1.c4 FROM s1.t1 v2t1 JOIN s1.t2 v2t2 ON(v2t1.c1 = v2t2.c1);
+CREATE VIEW s1.v3 AS SELECT v3t1.c1, v3t1.c2, v3t1.c3, v3t1.c4 FROM s1.t1 v3t1 JOIN s1.t2 v3t2 ON(v3t1.c1 = v3t2.c1) JOIN s1.t3 v3t3 ON(v3t1.c1 = v3t3.c1);
+
+ANALYZE;
+
+\q
+CREATE RULE r1_s_a AS ON SELECT TO s1.r1 WHERE true DO ALSO SELECT * FROM t1;
+CREATE RULE r1_s_i AS ON SELECT TO s1.r1 WHERE true DO INSTEAD SELECT * FROM t1;
+