OSDN Git Service

Change target version to PG11 and fix the SPEC file
[pghintplan/pg_hint_plan.git] / input / ut-fdw.source
1 LOAD 'pg_hint_plan';
2 SET search_path TO public;
3 SET pg_hint_plan.debug_print TO on;
4 SET client_min_messages TO LOG;
5 SET pg_hint_plan.enable_hint TO on;
6
7 CREATE EXTENSION file_fdw;
8 CREATE SERVER file_server FOREIGN DATA WRAPPER file_fdw;
9 CREATE USER MAPPING FOR PUBLIC SERVER file_server;
10 CREATE FOREIGN TABLE ft1 (id int, val int) SERVER file_server OPTIONS (format 'csv', filename '@abs_srcdir@/data/data.csv');
11
12 -- foreign table test
13 SELECT * FROM ft1;
14 \t
15 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
16
17 ----
18 ---- No. S-1-5 object type for the hint
19 ----
20
21 -- No. S-1-5-6
22 /*+SeqScan(t1)SeqScan(ft_1)SeqScan(ft_2)*/
23 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
24
25 ----
26 ---- No. J-1-6 object type for the hint
27 ----
28
29 -- No. J-1-6-6
30 /*+MergeJoin(ft_1 ft_2)Leading(ft_1 ft_2 t1)*/
31 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
32
33 ----
34 ---- No. L-1-6 object type for the hint
35 ----
36
37 -- No. L-1-6-6
38 /*+Leading(ft_1 ft_2 t1)*/
39 EXPLAIN (COSTS false) SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
40
41 ----
42 ---- No. R-1-6 object type for the hint
43 ----
44
45 -- No. R-1-6-6
46 \o results/ut-fdw.tmpout
47 /*+Rows(ft_1 ft_2 #1)Leading(ft_1 ft_2 t1)*/
48 EXPLAIN SELECT * FROM s1.t1, ft1 ft_1, ft1 ft_2 WHERE t1.c1 = ft_1.id AND t1.c1 = ft_2.id;
49 \o
50 \! sql/maskout.sh results/ut-fdw.tmpout
51 \! rm results/ut-fdw.tmpout