OSDN Git Service

A-13-4の試験の内容を項目表にあうように変更した。 1_1_0
authorTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Tue, 17 Sep 2013 06:01:00 +0000 (15:01 +0900)
committerTakashi Suzuki <suzuki.takashi@metrosystems.co.jp>
Tue, 17 Sep 2013 06:01:00 +0000 (15:01 +0900)
expected/ut-A-9.1.out
expected/ut-A-9.2.out
sql/ut-A.sql

index 4c138b7..80d986f 100644 (file)
@@ -4236,18 +4236,26 @@ error hint:
 ----
 ---- No. A-13-4 output of debugging log on hint status
 ----
+CREATE OR REPLACE FUNCTION recall_planner() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+$$ LANGUAGE SQL IMMUTABLE;
 --No.13-4-1
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(t_1 t_2)
@@ -4269,15 +4277,17 @@ error hint:
 --No.13-4-2
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(st_1 st_2)
@@ -4299,15 +4309,17 @@ error hint:
 --No.13-4-3
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4328,15 +4340,17 @@ error hint:
 --No.13-4-4
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4357,14 +4371,19 @@ error hint:
 --No.13-4-5
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4378,54 +4397,15 @@ error hint:
 (1 row)
 
 --No.13-4-6
-CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
-DECLARE
-    new_cnt int;
-BEGIN
-    RAISE NOTICE 'nested_planner_one_t(%)', cnt;
-
-    IF cnt <= 1 THEN
-        RETURN 0;
-    END IF;
-
-       SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1) INTO new_cnt
+CREATE OR REPLACE FUNCTION recall_planner_one_t() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
          FROM s1.t1 t_1
         ORDER BY t_1.c1 LIMIT 1;
-
-    RETURN new_cnt;
-END;
-$$ LANGUAGE plpgsql IMMUTABLE;
+$$ LANGUAGE SQL IMMUTABLE;
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner_one_t(2)
-LOG:  pg_hint_plan:
-used hint:
-IndexScan(t_1)
-not used hint:
-duplication hint:
-error hint:
-
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner_one_t" line 11 at SQL statement
-NOTICE:  nested_planner_one_t(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner_one_t" line 11 at SQL statement
-LOG:  pg_hint_plan:
-used hint:
-not used hint:
-IndexScan(t_1)
-duplication hint:
-error hint:
-
-CONTEXT:  SQL statement "SELECT 0"
-PL/pgSQL function "nested_planner_one_t" line 8 at RETURN
-SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner_one_t" line 11 at SQL statement
                QUERY PLAN               
 ----------------------------------------
  Merge Join
@@ -4438,14 +4418,17 @@ PL/pgSQL function "nested_planner_one_t" line 11 at SQL statement
 
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner_one_t(2)
-NOTICE:  nested_planner_one_t(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner_one_t" line 11 at SQL statement
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+CONTEXT:  SQL function "recall_planner_one_t" during startup
 INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
 DETAIL:  Relation name "t_1" is duplicated.
 LOG:  pg_hint_plan:
@@ -4465,19 +4448,25 @@ HashJoin(t_1 t_1)
          ->  Seq Scan on t2 t_2
 (6 rows)
 
-DROP FUNCTION nested_planner_one_t(int);
+DROP FUNCTION recall_planner_one_t(int);
+ERROR:  function recall_planner_one_t(integer) does not exist
 --No.13-4-7
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT:  SQL function "recall_planner" during startup
 INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
 DETAIL:  Relation name "t_1" is duplicated.
 LOG:  pg_hint_plan:
@@ -4500,17 +4489,23 @@ HashJoin(t_1 t_1)
 --No.13-4-8
 /*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 INFO:  hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
 DETAIL:  Conflict join method hint.
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function "nested_planner" line 12 at SQL statement
+INFO:  hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL:  Conflict join method hint.
+CONTEXT:  SQL function "recall_planner" during startup
+LOG:  pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(t_1 t_2)
index 4bfd135..f38524c 100644 (file)
@@ -4544,29 +4544,26 @@ error hint:
 ----
 ---- No. A-13-4 output of debugging log on hint status
 ----
+CREATE OR REPLACE FUNCTION recall_planner() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+$$ LANGUAGE SQL IMMUTABLE;
 --No.13-4-1
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
+HashJoin(t_1 t_2)
 not used hint:
 duplication hint:
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(t_1 t_2)
@@ -4588,26 +4585,17 @@ error hint:
 --No.13-4-2
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
 not used hint:
+HashJoin(st_1 st_2)
 duplication hint:
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(st_1 st_2)
@@ -4629,26 +4617,17 @@ error hint:
 --No.13-4-3
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
+HashJoin(t_1 t_2)
 not used hint:
 duplication hint:
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4669,26 +4648,17 @@ error hint:
 --No.13-4-4
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
 not used hint:
+HashJoin(st_1 st_2)
 duplication hint:
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4709,25 +4679,19 @@ error hint:
 --No.13-4-5
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
 not used hint:
 duplication hint:
 error hint:
+HashJoin(t_1 t_1)
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 not used hint:
@@ -4741,53 +4705,15 @@ error hint:
 (1 row)
 
 --No.13-4-6
-CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
-DECLARE
-    new_cnt int;
-BEGIN
-    RAISE NOTICE 'nested_planner_one_t(%)', cnt;
-
-    IF cnt <= 1 THEN
-        RETURN 0;
-    END IF;
-
-       SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1) INTO new_cnt
+CREATE OR REPLACE FUNCTION recall_planner_one_t() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
          FROM s1.t1 t_1
         ORDER BY t_1.c1 LIMIT 1;
-
-    RETURN new_cnt;
-END;
-$$ LANGUAGE plpgsql IMMUTABLE;
+$$ LANGUAGE SQL IMMUTABLE;
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner_one_t(2)
-NOTICE:  nested_planner_one_t(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
-LOG:  pg_hint_plan:
-used hint:
-not used hint:
-IndexScan(t_1)
-duplication hint:
-error hint:
-
-CONTEXT:  PL/pgSQL function nested_planner_one_t(integer) line 8 at RETURN
-SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
-LOG:  pg_hint_plan:
-used hint:
-IndexScan(t_1)
-not used hint:
-duplication hint:
-error hint:
-
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
                  QUERY PLAN                  
 ---------------------------------------------
  Merge Join
@@ -4800,24 +4726,17 @@ PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
 
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner_one_t(2)
-NOTICE:  nested_planner_one_t(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
 not used hint:
+HashJoin(t_1 t_1)
 duplication hint:
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1)                 FROM s1.t1 t_1
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner_one_t(integer) line 11 at SQL statement
+CONTEXT:  SQL function "recall_planner_one_t" during startup
 INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
 DETAIL:  Relation name "t_1" is duplicated.
 LOG:  pg_hint_plan:
@@ -4837,30 +4756,25 @@ HashJoin(t_1 t_1)
          ->  Seq Scan on t2 t_2
 (6 rows)
 
-DROP FUNCTION nested_planner_one_t(int);
+DROP FUNCTION recall_planner_one_t(int);
+ERROR:  function recall_planner_one_t(integer) does not exist
 --No.13-4-7
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL:  Relation name "t_1" is duplicated.
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
 not used hint:
 duplication hint:
 error hint:
+HashJoin(t_1 t_1)
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 INFO:  hint syntax error at or near "HashJoin(t_1 t_1)"
 DETAIL:  Relation name "t_1" is duplicated.
 LOG:  pg_hint_plan:
@@ -4883,28 +4797,23 @@ HashJoin(t_1 t_1)
 --No.13-4-8
 /*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 INFO:  hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
 DETAIL:  Conflict join method hint.
-NOTICE:  nested_planner(2)
-NOTICE:  nested_planner(1)
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+INFO:  hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL:  Conflict join method hint.
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
-IndexScan(t_1)
+HashJoin(t_1 t_2)
 not used hint:
 duplication hint:
+MergeJoin(t_1 t_2)
 error hint:
 
-CONTEXT:  SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)                 FROM s1.t1 t_1
-         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
-        ORDER BY t_1.c1 LIMIT 1"
-PL/pgSQL function nested_planner(integer) line 12 at SQL statement
+CONTEXT:  SQL function "recall_planner" during startup
 LOG:  pg_hint_plan:
 used hint:
 HashJoin(t_1 t_2)
index 17b7bc6..30c02e2 100644 (file)
@@ -1114,82 +1114,76 @@ EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
 ----
 ---- No. A-13-4 output of debugging log on hint status
 ----
+CREATE OR REPLACE FUNCTION recall_planner() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
+         FROM s1.t1 t_1
+         JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+        ORDER BY t_1.c1 LIMIT 1;
+$$ LANGUAGE SQL IMMUTABLE;
 
 --No.13-4-1
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 
 --No.13-4-2
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
 
 --No.13-4-3
 /*+HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 st_1
+ SELECT recall_planner() FROM s1.t1 st_1
    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
   ORDER BY st_1.c1;
 
 --No.13-4-4
 /*+HashJoin(st_1 st_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 
 --No.13-4-5
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
   ORDER BY t_1.c1;
 
 --No.13-4-6
-CREATE OR REPLACE FUNCTION nested_planner_one_t(cnt int) RETURNS int AS $$
-DECLARE
-    new_cnt int;
-BEGIN
-    RAISE NOTICE 'nested_planner_one_t(%)', cnt;
-
-    IF cnt <= 1 THEN
-        RETURN 0;
-    END IF;
-
-       SELECT /*+ IndexScan(t_1) */ nested_planner_one_t(cnt - 1) INTO new_cnt
+CREATE OR REPLACE FUNCTION recall_planner_one_t() RETURNS int AS $$
+       SELECT /*+ IndexScan(t_1) */t_1.c1
          FROM s1.t1 t_1
         ORDER BY t_1.c1 LIMIT 1;
-
-    RETURN new_cnt;
-END;
-$$ LANGUAGE plpgsql IMMUTABLE;
+$$ LANGUAGE SQL IMMUTABLE;
 
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner_one_t(2) FROM s1.t1 t_1
+ SELECT recall_planner_one_t() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 
-DROP FUNCTION nested_planner_one_t(int);
+DROP FUNCTION recall_planner_one_t(int);
 
 --No.13-4-7
 /*+HashJoin(t_1 t_1)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;
 
 --No.13-4-8
 /*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
 EXPLAIN (COSTS false)
- SELECT nested_planner(2) FROM s1.t1 t_1
+ SELECT recall_planner() FROM s1.t1 t_1
    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
   ORDER BY t_1.c1;