---- No. A-13-4 output of debugging log on hint status
----
--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
--No.13-4-2
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(st_1 st_2)
+not used hint:
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Sort
+ Sort Key: st_1.c1
+ -> Hash Join
+ Hash Cond: (st_1.c1 = st_2.c1)
+ -> Seq Scan on t1 st_1
+ -> Hash
+ -> Seq Scan on t2 st_2
+(7 rows)
+
--No.13-4-3
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+-----------------------------------------
+ Merge Join
+ Merge Cond: (st_1.c1 = st_2.c1)
+ -> Index Scan using t1_i1 on t1 st_1
+ -> Sort
+ Sort Key: st_2.c1
+ -> Seq Scan on t2 st_2
+(6 rows)
+
--No.13-4-4
+/*+HashJoin(st_1 st_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(st_1 st_2)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
--No.13-4-5
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) FROM s1.t1 t_1
+ ORDER BY t_1.c1;
+NOTICE: nested_planner(2)
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+ QUERY PLAN
+----------------------------------
+ Index Scan using t1_i1 on t1 t_1
+(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;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner_one_t($1) FROM s1.t1 t_1'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+/*+HashJoin(t_1 t_1)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) 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 "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+HashJoin(t_1 t_1)
+duplication hint:
+error hint:
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner_one_t($1) FROM s1.t1 t_1 ORDER BY t_1.c1 LIMIT 1"
+PL/pgSQL function "nested_planner_one_t" line 11 at EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
+DROP FUNCTION nested_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
+ 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 "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+INFO: hint syntax error at or near "HashJoin(t_1 t_1)"
+DETAIL: Relation name "t_1" is duplicated.
+LOG: pg_hint_plan:
+used hint:
+not used hint:
+duplication hint:
+error hint:
+HashJoin(t_1 t_1)
+
+ QUERY PLAN
+----------------------------------------
+ Merge Join
+ Merge Cond: (t_1.c1 = t_2.c1)
+ -> Index Scan using t1_i1 on t1 t_1
+ -> Sort
+ Sort Key: t_2.c1
+ -> Seq Scan on t2 t_2
+(6 rows)
+
--No.13-4-8
+/*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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)
+INFO: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
+DETAIL: Conflict join method hint.
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+NOTICE: nested_planner(1)
+CONTEXT: SQL statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+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 statement "/*+ IndexScan(t_1) */ SELECT nested_planner($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 EXECUTE statement
+LOG: pg_hint_plan:
+used hint:
+HashJoin(t_1 t_2)
+not used hint:
+duplication hint:
+MergeJoin(t_1 t_2)
+error hint:
+
+ QUERY PLAN
+--------------------------------------
+ Sort
+ Sort Key: t_1.c1
+ -> Hash Join
+ Hash Cond: (t_1.c1 = t_2.c1)
+ -> Seq Scan on t1 t_1
+ -> Hash
+ -> Seq Scan on t2 t_2
+(7 rows)
+
----
--No.13-4-1
+/*+HashJoin(t_1 t_2)*/
+EXPLAIN (COSTS false)
+ SELECT nested_planner(2) 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
+ 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
+ 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
+ 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
+ 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;
+
+ EXECUTE '/*+ IndexScan(t_1) */'
+ ' SELECT nested_planner_one_t($1) FROM s1.t1 t_1'
+ ' ORDER BY t_1.c1 LIMIT 1'
+ INTO new_cnt USING cnt - 1;
+
+ RETURN new_cnt;
+END;
+$$ LANGUAGE plpgsql IMMUTABLE;
+
+EXPLAIN (COSTS false)
+ SELECT nested_planner_one_t(2) 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
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;
+
+DROP FUNCTION nested_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
+ 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
+ JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
+ ORDER BY t_1.c1;