OSDN Git Service

Restore current hint state when returned from non-hinted query planning.
[pghintplan/pg_hint_plan.git] / expected / ut-A.out
1 LOAD 'pg_hint_plan';
2 SET pg_hint_plan.enable_hint TO on;
3 SET pg_hint_plan.debug_print TO on;
4 SET client_min_messages TO LOG;
5 SET search_path TO public;
6 ----
7 ---- No.A-1-1 install
8 ---- No.A-2-1 uninstall
9 ----
10 -- No.A-1-1-3
11 CREATE EXTENSION pg_hint_plan;
12 -- No.A-1-2-3
13 DROP EXTENSION pg_hint_plan;
14 -- No.A-1-1-4
15 CREATE SCHEMA other_schema;
16 CREATE EXTENSION pg_hint_plan SCHEMA other_schema;
17 ERROR:  extension "pg_hint_plan" must be installed in schema "hint_plan"
18 CREATE EXTENSION pg_hint_plan;
19 DROP SCHEMA other_schema;
20 ----
21 ---- No. A-5-1 comment pattern
22 ----
23 -- No. A-5-1-1
24 /*+SeqScan(t1)*/
25 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
26 LOG:  pg_hint_plan:
27 used hint:
28 SeqScan(t1)
29 not used hint:
30 duplication hint:
31 error hint:
32
33      QUERY PLAN     
34 --------------------
35  Seq Scan on t1
36    Filter: (c1 = 1)
37 (2 rows)
38
39 -- No. A-5-1-2
40 /* +SeqScan(t1)*/
41 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
42           QUERY PLAN          
43 ------------------------------
44  Index Scan using t1_i1 on t1
45    Index Cond: (c1 = 1)
46 (2 rows)
47
48 -- No. A-5-1-3
49 /*SeqScan(t1)*/
50 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
51           QUERY PLAN          
52 ------------------------------
53  Index Scan using t1_i1 on t1
54    Index Cond: (c1 = 1)
55 (2 rows)
56
57 -- No. A-5-1-4
58 --+SeqScan(t1)
59 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
60           QUERY PLAN          
61 ------------------------------
62  Index Scan using t1_i1 on t1
63    Index Cond: (c1 = 1)
64 (2 rows)
65
66 -- No. A-5-1-5
67 /* /*+SeqScan(t1)*/  */
68 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
69           QUERY PLAN          
70 ------------------------------
71  Index Scan using t1_i1 on t1
72    Index Cond: (c1 = 1)
73 (2 rows)
74
75 ----
76 ---- No. A-5-2 hint position
77 ----
78 -- No. A-5-2-1
79 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
80             QUERY PLAN             
81 -----------------------------------
82  Index Only Scan using t1_i1 on t1
83    Index Cond: (c1 = 1)
84 (2 rows)
85
86 /*+SeqScan(t1)*/
87 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1 WHERE t1.c1 = 1;
88 LOG:  pg_hint_plan:
89 used hint:
90 SeqScan(t1)
91 not used hint:
92 duplication hint:
93 error hint:
94
95      QUERY PLAN     
96 --------------------
97  Seq Scan on t1
98    Filter: (c1 = 1)
99 (2 rows)
100
101 -- No. A-5-2-2
102 EXPLAIN (COSTS false) SELECT c1, c2 AS c_2 /*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
103 LOG:  pg_hint_plan:
104 used hint:
105 SeqScan(t1)
106 not used hint:
107 duplication hint:
108 error hint:
109
110      QUERY PLAN     
111 --------------------
112  Seq Scan on t1
113    Filter: (c1 = 1)
114 (2 rows)
115
116 -- No. A-5-2-3
117 EXPLAIN (COSTS false) SELECT c1 AS "c1"/*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
118             QUERY PLAN             
119 -----------------------------------
120  Index Only Scan using t1_i1 on t1
121    Index Cond: (c1 = 1)
122 (2 rows)
123
124 -- No. A-5-2-4
125 EXPLAIN (COSTS false) SELECT * /*+SeqScan(t1)*/ FROM s1.t1 WHERE t1.c1 = 1;
126           QUERY PLAN          
127 ------------------------------
128  Index Scan using t1_i1 on t1
129    Index Cond: (c1 = 1)
130 (2 rows)
131
132 ----
133 ---- No. A-6-1 hint's table definition
134 ----
135 SET pg_hint_plan.enable_hint_table TO on;
136 -- No. A-6-1-1
137 \d hint_plan.hints
138                                      Table "hint_plan.hints"
139       Column       |  Type   | Collation | Nullable |                   Default                   
140 -------------------+---------+-----------+----------+---------------------------------------------
141  id                | integer |           | not null | nextval('hint_plan.hints_id_seq'::regclass)
142  norm_query_string | text    |           | not null | 
143  application_name  | text    |           | not null | 
144  hints             | text    |           | not null | 
145 Indexes:
146     "hints_pkey" PRIMARY KEY, btree (id)
147     "hints_norm_and_app" UNIQUE, btree (norm_query_string, application_name)
148
149 ----
150 ---- No. A-6-2 search condition
151 ----
152 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
153           QUERY PLAN          
154 ------------------------------
155  Index Scan using t1_i1 on t1
156    Index Cond: (c1 = 1)
157 (2 rows)
158
159 -- No. A-6-2-1
160 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
161         VALUES (
162         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
163         '',
164         'SeqScan(t1)');
165 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
166 LOG:  pg_hint_plan:
167 used hint:
168 SeqScan(t1)
169 not used hint:
170 duplication hint:
171 error hint:
172
173      QUERY PLAN     
174 --------------------
175  Seq Scan on t1
176    Filter: (c1 = 1)
177 (2 rows)
178
179 -- No. A-6-2-2
180 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
181         VALUES (
182         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
183         'psql',
184         'BitmapScan(t1)');
185 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
186 LOG:  pg_hint_plan:
187 used hint:
188 SeqScan(t1)
189 not used hint:
190 duplication hint:
191 error hint:
192
193      QUERY PLAN     
194 --------------------
195  Seq Scan on t1
196    Filter: (c1 = 1)
197 (2 rows)
198
199 TRUNCATE hint_plan.hints;
200 -- No. A-6-2-3
201 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
202         VALUES (
203         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
204         'dummy_application_name',
205         'SeqScan(t1)'
206 );
207 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
208           QUERY PLAN          
209 ------------------------------
210  Index Scan using t1_i1 on t1
211    Index Cond: (c1 = 1)
212 (2 rows)
213
214 TRUNCATE hint_plan.hints;
215 -- No. A-6-2-4
216 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
217         VALUES (
218         'EXPLAIN (COSTS false) SELECT * FROM s1.t1;',
219         '',
220         'SeqScan(t1)'
221 );
222 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
223           QUERY PLAN          
224 ------------------------------
225  Index Scan using t1_i1 on t1
226    Index Cond: (c1 = 1)
227 (2 rows)
228
229 TRUNCATE hint_plan.hints;
230 ----
231 ---- No. A-6-3 number of constant
232 ----
233 -- No. A-6-3-1
234 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
235         VALUES (
236         'EXPLAIN (COSTS false) SELECT c1 FROM s1.t1;',
237         '',
238         'SeqScan(t1)'
239 );
240 EXPLAIN (COSTS false) SELECT c1 FROM s1.t1;
241 LOG:  pg_hint_plan:
242 used hint:
243 SeqScan(t1)
244 not used hint:
245 duplication hint:
246 error hint:
247
248    QUERY PLAN   
249 ----------------
250  Seq Scan on t1
251 (1 row)
252
253 TRUNCATE hint_plan.hints;
254 -- No. A-6-3-2
255 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
256         VALUES (
257         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
258         '',
259         'SeqScan(t1)'
260 );
261 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
262 LOG:  pg_hint_plan:
263 used hint:
264 SeqScan(t1)
265 not used hint:
266 duplication hint:
267 error hint:
268
269      QUERY PLAN     
270 --------------------
271  Seq Scan on t1
272    Filter: (c1 = 1)
273 (2 rows)
274
275 TRUNCATE hint_plan.hints;
276 -- No. A-6-3-3
277 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
278         VALUES (
279         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ? OR t1.c1 = ?;',
280         '',
281         'SeqScan(t1)'
282 );
283 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 OR t1.c1 = 0;
284 LOG:  pg_hint_plan:
285 used hint:
286 SeqScan(t1)
287 not used hint:
288 duplication hint:
289 error hint:
290
291             QUERY PLAN            
292 ----------------------------------
293  Seq Scan on t1
294    Filter: ((c1 = 1) OR (c1 = 0))
295 (2 rows)
296
297 TRUNCATE hint_plan.hints;
298 SET pg_hint_plan.enable_hint_table TO off;
299 ----
300 ---- No. A-7-2 hint delimiter
301 ----
302 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
303           QUERY PLAN          
304 ------------------------------
305  Index Scan using t1_i1 on t1
306    Index Cond: (c1 = 1)
307 (2 rows)
308
309 -- No. A-7-2-1
310 -- No. A-7-2-2
311 -- No. A-7-2-3
312 -- No. A-7-2-4
313 -- No. A-7-2-5
314 -- No. A-7-2-6
315 -- No. A-7-2-7
316 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
317 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
318 LOG:  pg_hint_plan:
319 used hint:
320 Set(enable_bitmapscan off)
321 Set(enable_indexscan off)
322 not used hint:
323 duplication hint:
324 error hint:
325
326      QUERY PLAN     
327 --------------------
328  Seq Scan on t1
329    Filter: (c1 = 1)
330 (2 rows)
331
332 -- No. A-7-2-8
333 /*+ Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
334 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
335 LOG:  pg_hint_plan:
336 used hint:
337 Set(enable_bitmapscan off)
338 Set(enable_indexscan off)
339 not used hint:
340 duplication hint:
341 error hint:
342
343      QUERY PLAN     
344 --------------------
345  Seq Scan on t1
346    Filter: (c1 = 1)
347 (2 rows)
348
349 -- No. A-7-2-9
350 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off") */
351 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
352 LOG:  pg_hint_plan:
353 used hint:
354 Set(enable_bitmapscan off)
355 Set(enable_indexscan off)
356 not used hint:
357 duplication hint:
358 error hint:
359
360      QUERY PLAN     
361 --------------------
362  Seq Scan on t1
363    Filter: (c1 = 1)
364 (2 rows)
365
366 -- No. A-7-2-10
367 /*+ Set (enable_indexscan"off") Set (enable_bitmapscan"off")*/
368 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
369 LOG:  pg_hint_plan:
370 used hint:
371 Set(enable_bitmapscan off)
372 Set(enable_indexscan off)
373 not used hint:
374 duplication hint:
375 error hint:
376
377      QUERY PLAN     
378 --------------------
379  Seq Scan on t1
380    Filter: (c1 = 1)
381 (2 rows)
382
383 -- No. A-7-2-11
384 /*+Set ( enable_indexscan"off")Set ( enable_bitmapscan"off")*/
385 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
386 LOG:  pg_hint_plan:
387 used hint:
388 Set(enable_bitmapscan off)
389 Set(enable_indexscan off)
390 not used hint:
391 duplication hint:
392 error hint:
393
394      QUERY PLAN     
395 --------------------
396  Seq Scan on t1
397    Filter: (c1 = 1)
398 (2 rows)
399
400 -- No. A-7-2-12
401 /*+Set(enable_indexscan"off" ) Set(enable_bitmapscan"off" ) */
402 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
403 LOG:  pg_hint_plan:
404 used hint:
405 Set(enable_bitmapscan off)
406 Set(enable_indexscan off)
407 not used hint:
408 duplication hint:
409 error hint:
410
411      QUERY PLAN     
412 --------------------
413  Seq Scan on t1
414    Filter: (c1 = 1)
415 (2 rows)
416
417 -- No. A-7-2-13
418 /*+Set( enable_indexscan "off" )Set( enable_bitmapscan "off" )*/
419 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
420 LOG:  pg_hint_plan:
421 used hint:
422 Set(enable_bitmapscan off)
423 Set(enable_indexscan off)
424 not used hint:
425 duplication hint:
426 error hint:
427
428      QUERY PLAN     
429 --------------------
430  Seq Scan on t1
431    Filter: (c1 = 1)
432 (2 rows)
433
434 -- No. A-7-2-14
435 /*+ Set ( enable_indexscan "off" ) Set ( enable_bitmapscan "off" ) */
436 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
437 LOG:  pg_hint_plan:
438 used hint:
439 Set(enable_bitmapscan off)
440 Set(enable_indexscan off)
441 not used hint:
442 duplication hint:
443 error hint:
444
445      QUERY PLAN     
446 --------------------
447  Seq Scan on t1
448    Filter: (c1 = 1)
449 (2 rows)
450
451 -- No. A-7-2-15
452 /*+     Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
453 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
454 LOG:  pg_hint_plan:
455 used hint:
456 Set(enable_bitmapscan off)
457 Set(enable_indexscan off)
458 not used hint:
459 duplication hint:
460 error hint:
461
462      QUERY PLAN     
463 --------------------
464  Seq Scan on t1
465    Filter: (c1 = 1)
466 (2 rows)
467
468 -- No. A-7-2-16
469 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")        */
470 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
471 LOG:  pg_hint_plan:
472 used hint:
473 Set(enable_bitmapscan off)
474 Set(enable_indexscan off)
475 not used hint:
476 duplication hint:
477 error hint:
478
479      QUERY PLAN     
480 --------------------
481  Seq Scan on t1
482    Filter: (c1 = 1)
483 (2 rows)
484
485 -- No. A-7-2-17
486 /*+     Set     (enable_indexscan"off") Set     (enable_bitmapscan"off")*/
487 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
488 LOG:  pg_hint_plan:
489 used hint:
490 Set(enable_bitmapscan off)
491 Set(enable_indexscan off)
492 not used hint:
493 duplication hint:
494 error hint:
495
496      QUERY PLAN     
497 --------------------
498  Seq Scan on t1
499    Filter: (c1 = 1)
500 (2 rows)
501
502 -- No. A-7-2-18
503 /*+Set  (       enable_indexscan"off")Set       (       enable_bitmapscan"off")*/
504 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
505 LOG:  pg_hint_plan:
506 used hint:
507 Set(enable_bitmapscan off)
508 Set(enable_indexscan off)
509 not used hint:
510 duplication hint:
511 error hint:
512
513      QUERY PLAN     
514 --------------------
515  Seq Scan on t1
516    Filter: (c1 = 1)
517 (2 rows)
518
519 -- No. A-7-2-19
520 /*+Set(enable_indexscan"off"    )       Set(enable_bitmapscan"off"      )       */
521 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
522 LOG:  pg_hint_plan:
523 used hint:
524 Set(enable_bitmapscan off)
525 Set(enable_indexscan off)
526 not used hint:
527 duplication hint:
528 error hint:
529
530      QUERY PLAN     
531 --------------------
532  Seq Scan on t1
533    Filter: (c1 = 1)
534 (2 rows)
535
536 -- No. A-7-2-20
537 /*+Set( enable_indexscan        "off"   )Set(   enable_bitmapscan       "off"   )*/
538 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
539 LOG:  pg_hint_plan:
540 used hint:
541 Set(enable_bitmapscan off)
542 Set(enable_indexscan off)
543 not used hint:
544 duplication hint:
545 error hint:
546
547      QUERY PLAN     
548 --------------------
549  Seq Scan on t1
550    Filter: (c1 = 1)
551 (2 rows)
552
553 -- No. A-7-2-21
554 /*+     Set     (       enable_indexscan        "off"   )       Set     (       enable_bitmapscan       "off"   )       */
555 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
556 LOG:  pg_hint_plan:
557 used hint:
558 Set(enable_bitmapscan off)
559 Set(enable_indexscan off)
560 not used hint:
561 duplication hint:
562 error hint:
563
564      QUERY PLAN     
565 --------------------
566  Seq Scan on t1
567    Filter: (c1 = 1)
568 (2 rows)
569
570 -- No. A-7-2-22
571 /*+
572 Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
573 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
574 LOG:  pg_hint_plan:
575 used hint:
576 Set(enable_bitmapscan off)
577 Set(enable_indexscan off)
578 not used hint:
579 duplication hint:
580 error hint:
581
582      QUERY PLAN     
583 --------------------
584  Seq Scan on t1
585    Filter: (c1 = 1)
586 (2 rows)
587
588 -- No. A-7-2-23
589 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")
590 */
591 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
592 LOG:  pg_hint_plan:
593 used hint:
594 Set(enable_bitmapscan off)
595 Set(enable_indexscan off)
596 not used hint:
597 duplication hint:
598 error hint:
599
600      QUERY PLAN     
601 --------------------
602  Seq Scan on t1
603    Filter: (c1 = 1)
604 (2 rows)
605
606 -- No. A-7-2-24
607 /*+
608 Set
609 (enable_indexscan"off")
610 Set
611 (enable_bitmapscan"off")*/
612 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
613 LOG:  pg_hint_plan:
614 used hint:
615 Set(enable_bitmapscan off)
616 Set(enable_indexscan off)
617 not used hint:
618 duplication hint:
619 error hint:
620
621      QUERY PLAN     
622 --------------------
623  Seq Scan on t1
624    Filter: (c1 = 1)
625 (2 rows)
626
627 -- No. A-7-2-25
628 /*+Set
629 (
630 enable_indexscan"off")Set
631 (
632 enable_bitmapscan"off")*/
633 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
634 LOG:  pg_hint_plan:
635 used hint:
636 Set(enable_bitmapscan off)
637 Set(enable_indexscan off)
638 not used hint:
639 duplication hint:
640 error hint:
641
642      QUERY PLAN     
643 --------------------
644  Seq Scan on t1
645    Filter: (c1 = 1)
646 (2 rows)
647
648 -- No. A-7-2-26
649 /*+Set(enable_indexscan"off"
650 )
651 Set(enable_bitmapscan"off"
652 )
653 */
654 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
655 LOG:  pg_hint_plan:
656 used hint:
657 Set(enable_bitmapscan off)
658 Set(enable_indexscan off)
659 not used hint:
660 duplication hint:
661 error hint:
662
663      QUERY PLAN     
664 --------------------
665  Seq Scan on t1
666    Filter: (c1 = 1)
667 (2 rows)
668
669 -- No. A-7-2-27
670 /*+Set(
671 enable_indexscan
672 "off"
673 )Set(
674 enable_bitmapscan
675 "off"
676 )*/
677 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
678 LOG:  pg_hint_plan:
679 used hint:
680 Set(enable_bitmapscan off)
681 Set(enable_indexscan off)
682 not used hint:
683 duplication hint:
684 error hint:
685
686      QUERY PLAN     
687 --------------------
688  Seq Scan on t1
689    Filter: (c1 = 1)
690 (2 rows)
691
692 -- No. A-7-2-28
693 /*+
694 Set
695 (
696 enable_indexscan
697 "off"
698 )
699 Set
700 (
701 enable_bitmapscan
702 "off"
703 )
704 */
705 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
706 LOG:  pg_hint_plan:
707 used hint:
708 Set(enable_bitmapscan off)
709 Set(enable_indexscan off)
710 not used hint:
711 duplication hint:
712 error hint:
713
714      QUERY PLAN     
715 --------------------
716  Seq Scan on t1
717    Filter: (c1 = 1)
718 (2 rows)
719
720 -- No. A-7-2-29
721 /*+     
722          Set(enable_indexscan"off")Set(enable_bitmapscan"off")*/
723 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
724 LOG:  pg_hint_plan:
725 used hint:
726 Set(enable_bitmapscan off)
727 Set(enable_indexscan off)
728 not used hint:
729 duplication hint:
730 error hint:
731
732      QUERY PLAN     
733 --------------------
734  Seq Scan on t1
735    Filter: (c1 = 1)
736 (2 rows)
737
738 -- No. A-7-2-30
739 /*+Set(enable_indexscan"off")Set(enable_bitmapscan"off")        
740          */
741 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
742 LOG:  pg_hint_plan:
743 used hint:
744 Set(enable_bitmapscan off)
745 Set(enable_indexscan off)
746 not used hint:
747 duplication hint:
748 error hint:
749
750      QUERY PLAN     
751 --------------------
752  Seq Scan on t1
753    Filter: (c1 = 1)
754 (2 rows)
755
756 -- No. A-7-2-31
757 /*+     
758          Set    
759          (enable_indexscan"off")        
760          Set    
761          (enable_bitmapscan"off")*/
762 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
763 LOG:  pg_hint_plan:
764 used hint:
765 Set(enable_bitmapscan off)
766 Set(enable_indexscan off)
767 not used hint:
768 duplication hint:
769 error hint:
770
771      QUERY PLAN     
772 --------------------
773  Seq Scan on t1
774    Filter: (c1 = 1)
775 (2 rows)
776
777 -- No. A-7-2-32
778 /*+Set  
779          (      
780          enable_indexscan"off")Set      
781          (      
782          enable_bitmapscan"off")*/
783 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
784 LOG:  pg_hint_plan:
785 used hint:
786 Set(enable_bitmapscan off)
787 Set(enable_indexscan off)
788 not used hint:
789 duplication hint:
790 error hint:
791
792      QUERY PLAN     
793 --------------------
794  Seq Scan on t1
795    Filter: (c1 = 1)
796 (2 rows)
797
798 -- No. A-7-2-33
799 /*+Set(enable_indexscan"off"    
800          )      
801          Set(enable_bitmapscan"off"     
802          )      
803          */
804 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
805 LOG:  pg_hint_plan:
806 used hint:
807 Set(enable_bitmapscan off)
808 Set(enable_indexscan off)
809 not used hint:
810 duplication hint:
811 error hint:
812
813      QUERY PLAN     
814 --------------------
815  Seq Scan on t1
816    Filter: (c1 = 1)
817 (2 rows)
818
819 -- No. A-7-2-34
820 /*+Set(         
821          enable_indexscan       
822          "off"  
823          )Set(  
824          enable_bitmapscan      
825          "off"  
826          )*/
827 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
828 LOG:  pg_hint_plan:
829 used hint:
830 Set(enable_bitmapscan off)
831 Set(enable_indexscan off)
832 not used hint:
833 duplication hint:
834 error hint:
835
836      QUERY PLAN     
837 --------------------
838  Seq Scan on t1
839    Filter: (c1 = 1)
840 (2 rows)
841
842 -- No. A-7-2-35
843 /*+     
844          Set    
845          (      
846          enable_indexscan       
847          "off"  
848          )      
849          Set    
850          (      
851          enable_bitmapscan      
852          "off"  
853          )      
854          */
855 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
856 LOG:  pg_hint_plan:
857 used hint:
858 Set(enable_bitmapscan off)
859 Set(enable_indexscan off)
860 not used hint:
861 duplication hint:
862 error hint:
863
864      QUERY PLAN     
865 --------------------
866  Seq Scan on t1
867    Filter: (c1 = 1)
868 (2 rows)
869
870 ----
871 ---- No. A-7-3 hint object pattern
872 ---- No. A-9-2 message object pattern
873 ----
874 -- No. A-7-3-1
875 -- No. A-9-2-1
876 /*+SeqScan(t)*/
877 EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
878 LOG:  pg_hint_plan:
879 used hint:
880 SeqScan(t)
881 not used hint:
882 duplication hint:
883 error hint:
884
885      QUERY PLAN     
886 --------------------
887  Seq Scan on t1 t
888    Filter: (c1 = 1)
889 (2 rows)
890
891 /*+SeqScan(ttt)*/
892 EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
893 LOG:  pg_hint_plan:
894 used hint:
895 SeqScan(ttt)
896 not used hint:
897 duplication hint:
898 error hint:
899
900      QUERY PLAN     
901 --------------------
902  Seq Scan on t1 ttt
903    Filter: (c1 = 1)
904 (2 rows)
905
906 /*+SeqScan("t")*/
907 EXPLAIN (COSTS false) SELECT * FROM s1.t1 t WHERE t.c1 = 1;
908 LOG:  pg_hint_plan:
909 used hint:
910 SeqScan(t)
911 not used hint:
912 duplication hint:
913 error hint:
914
915      QUERY PLAN     
916 --------------------
917  Seq Scan on t1 t
918    Filter: (c1 = 1)
919 (2 rows)
920
921 /*+SeqScan("ttt")*/
922 EXPLAIN (COSTS false) SELECT * FROM s1.t1 ttt WHERE ttt.c1 = 1;
923 LOG:  pg_hint_plan:
924 used hint:
925 SeqScan(ttt)
926 not used hint:
927 duplication hint:
928 error hint:
929
930      QUERY PLAN     
931 --------------------
932  Seq Scan on t1 ttt
933    Filter: (c1 = 1)
934 (2 rows)
935
936 -- No. A-7-3-2
937 -- No. A-9-2-2
938 /*+SeqScan(T)*/
939 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
940 LOG:  pg_hint_plan:
941 used hint:
942 SeqScan(T)
943 not used hint:
944 duplication hint:
945 error hint:
946
947      QUERY PLAN     
948 --------------------
949  Seq Scan on t1 "T"
950    Filter: (c1 = 1)
951 (2 rows)
952
953 /*+SeqScan(TTT)*/
954 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
955 LOG:  pg_hint_plan:
956 used hint:
957 SeqScan(TTT)
958 not used hint:
959 duplication hint:
960 error hint:
961
962       QUERY PLAN      
963 ----------------------
964  Seq Scan on t1 "TTT"
965    Filter: (c1 = 1)
966 (2 rows)
967
968 /*+SeqScan("T")*/
969 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "T" WHERE "T".c1 = 1;
970 LOG:  pg_hint_plan:
971 used hint:
972 SeqScan(T)
973 not used hint:
974 duplication hint:
975 error hint:
976
977      QUERY PLAN     
978 --------------------
979  Seq Scan on t1 "T"
980    Filter: (c1 = 1)
981 (2 rows)
982
983 /*+SeqScan("TTT")*/
984 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "TTT" WHERE "TTT".c1 = 1;
985 LOG:  pg_hint_plan:
986 used hint:
987 SeqScan(TTT)
988 not used hint:
989 duplication hint:
990 error hint:
991
992       QUERY PLAN      
993 ----------------------
994  Seq Scan on t1 "TTT"
995    Filter: (c1 = 1)
996 (2 rows)
997
998 -- No. A-7-3-3
999 -- No. A-9-2-3
1000 /*+SeqScan(()*/
1001 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
1002 INFO:  pg_hint_plan: hint syntax error at or near "()"
1003 DETAIL:  Zero-length delimited string.
1004             QUERY PLAN            
1005 ----------------------------------
1006  Index Scan using t1_i1 on t1 "("
1007    Index Cond: (c1 = 1)
1008 (2 rows)
1009
1010 /*+SeqScan("(")*/
1011 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "(" WHERE "(".c1 = 1;
1012 LOG:  pg_hint_plan:
1013 used hint:
1014 SeqScan("(")
1015 not used hint:
1016 duplication hint:
1017 error hint:
1018
1019      QUERY PLAN     
1020 --------------------
1021  Seq Scan on t1 "("
1022    Filter: (c1 = 1)
1023 (2 rows)
1024
1025 -- No. A-7-3-4
1026 -- No. A-9-2-4
1027 /*+SeqScan())*/
1028 EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
1029 INFO:  pg_hint_plan: hint syntax error at or near ")"
1030 DETAIL:  SeqScan hint requires a relation.
1031 INFO:  pg_hint_plan: hint syntax error at or near ")"
1032 DETAIL:  Unrecognized hint keyword ")".
1033 LOG:  pg_hint_plan:
1034 used hint:
1035 not used hint:
1036 duplication hint:
1037 error hint:
1038 SeqScan()
1039
1040             QUERY PLAN            
1041 ----------------------------------
1042  Index Scan using t1_i1 on t1 ")"
1043    Index Cond: (c1 = 1)
1044 (2 rows)
1045
1046 /*+SeqScan(")")*/
1047 EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")" WHERE ")".c1 = 1;
1048 LOG:  pg_hint_plan:
1049 used hint:
1050 SeqScan(")")
1051 not used hint:
1052 duplication hint:
1053 error hint:
1054
1055      QUERY PLAN     
1056 --------------------
1057  Seq Scan on t1 ")"
1058    Filter: (c1 = 1)
1059 (2 rows)
1060
1061 /*+SeqScan(")))")*/
1062 EXPLAIN (COSTS false) SELECT * FROM s1.t1 ")))" WHERE ")))".c1 = 1;
1063 LOG:  pg_hint_plan:
1064 used hint:
1065 SeqScan(")))")
1066 not used hint:
1067 duplication hint:
1068 error hint:
1069
1070       QUERY PLAN      
1071 ----------------------
1072  Seq Scan on t1 ")))"
1073    Filter: (c1 = 1)
1074 (2 rows)
1075
1076 -- No. A-7-3-5
1077 -- No. A-9-2-5
1078 /*+SeqScan(")*/
1079 EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
1080 INFO:  pg_hint_plan: hint syntax error at or near ""
1081 DETAIL:  Unterminated quoted string.
1082             QUERY PLAN             
1083 -----------------------------------
1084  Index Scan using t1_i1 on t1 """"
1085    Index Cond: (c1 = 1)
1086 (2 rows)
1087
1088 /*+SeqScan("""")*/
1089 EXPLAIN (COSTS false) SELECT * FROM s1.t1 """" WHERE """".c1 = 1;
1090 LOG:  pg_hint_plan:
1091 used hint:
1092 SeqScan("""")
1093 not used hint:
1094 duplication hint:
1095 error hint:
1096
1097      QUERY PLAN      
1098 ---------------------
1099  Seq Scan on t1 """"
1100    Filter: (c1 = 1)
1101 (2 rows)
1102
1103 /*+SeqScan("""""""")*/
1104 EXPLAIN (COSTS false) SELECT * FROM s1.t1 """""""" WHERE """""""".c1 = 1;
1105 LOG:  pg_hint_plan:
1106 used hint:
1107 SeqScan("""""""")
1108 not used hint:
1109 duplication hint:
1110 error hint:
1111
1112        QUERY PLAN        
1113 -------------------------
1114  Seq Scan on t1 """"""""
1115    Filter: (c1 = 1)
1116 (2 rows)
1117
1118 -- No. A-7-3-6
1119 -- No. A-9-2-6
1120 /*+SeqScan( )*/
1121 EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
1122 INFO:  pg_hint_plan: hint syntax error at or near ""
1123 DETAIL:  SeqScan hint requires a relation.
1124 LOG:  pg_hint_plan:
1125 used hint:
1126 not used hint:
1127 duplication hint:
1128 error hint:
1129 SeqScan()
1130
1131             QUERY PLAN            
1132 ----------------------------------
1133  Index Scan using t1_i1 on t1 " "
1134    Index Cond: (c1 = 1)
1135 (2 rows)
1136
1137 /*+SeqScan(" ")*/
1138 EXPLAIN (COSTS false) SELECT * FROM s1.t1 " " WHERE " ".c1 = 1;
1139 LOG:  pg_hint_plan:
1140 used hint:
1141 SeqScan(" ")
1142 not used hint:
1143 duplication hint:
1144 error hint:
1145
1146      QUERY PLAN     
1147 --------------------
1148  Seq Scan on t1 " "
1149    Filter: (c1 = 1)
1150 (2 rows)
1151
1152 /*+SeqScan("   ")*/
1153 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "   " WHERE "   ".c1 = 1;
1154 LOG:  pg_hint_plan:
1155 used hint:
1156 SeqScan("   ")
1157 not used hint:
1158 duplication hint:
1159 error hint:
1160
1161       QUERY PLAN      
1162 ----------------------
1163  Seq Scan on t1 "   "
1164    Filter: (c1 = 1)
1165 (2 rows)
1166
1167 -- No. A-7-3-7
1168 -- No. A-9-2-7
1169 /*+SeqScan(     )*/
1170 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "     " WHERE "       ".c1 = 1;
1171 INFO:  pg_hint_plan: hint syntax error at or near ""
1172 DETAIL:  SeqScan hint requires a relation.
1173 LOG:  pg_hint_plan:
1174 used hint:
1175 not used hint:
1176 duplication hint:
1177 error hint:
1178 SeqScan()
1179
1180             QUERY PLAN             
1181 -----------------------------------
1182  Index Scan using t1_i1 on t1 "  "
1183    Index Cond: (c1 = 1)
1184 (2 rows)
1185
1186 /*+SeqScan("    ")*/
1187 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "     " WHERE "       ".c1 = 1;
1188 LOG:  pg_hint_plan:
1189 used hint:
1190 SeqScan("       ")
1191 not used hint:
1192 duplication hint:
1193 error hint:
1194
1195         QUERY PLAN         
1196 ---------------------------
1197  Seq Scan on t1 "        "
1198    Filter: (c1 = 1)
1199 (2 rows)
1200
1201 /*+SeqScan("                    ")*/
1202 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "                     " WHERE "                       ".c1 = 1;
1203 LOG:  pg_hint_plan:
1204 used hint:
1205 SeqScan("                       ")
1206 not used hint:
1207 duplication hint:
1208 error hint:
1209
1210                 QUERY PLAN                 
1211 -------------------------------------------
1212  Seq Scan on t1 "                        "
1213    Filter: (c1 = 1)
1214 (2 rows)
1215
1216 -- No. A-7-3-8
1217 -- No. A-9-2-8
1218 /*+SeqScan(
1219 )*/
1220 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
1221 " WHERE "
1222 ".c1 = 1;
1223 INFO:  pg_hint_plan: hint syntax error at or near ""
1224 DETAIL:  SeqScan hint requires a relation.
1225 LOG:  pg_hint_plan:
1226 used hint:
1227 not used hint:
1228 duplication hint:
1229 error hint:
1230 SeqScan()
1231
1232            QUERY PLAN           
1233 --------------------------------
1234  Index Scan using t1_i1 on t1 "
1235  "
1236    Index Cond: (c1 = 1)
1237 (3 rows)
1238
1239 /*+SeqScan("
1240 ")*/
1241 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
1242 " WHERE "
1243 ".c1 = 1;
1244 LOG:  pg_hint_plan:
1245 used hint:
1246 SeqScan("
1247 ")
1248 not used hint:
1249 duplication hint:
1250 error hint:
1251
1252      QUERY PLAN     
1253 --------------------
1254  Seq Scan on t1 "
1255  "
1256    Filter: (c1 = 1)
1257 (3 rows)
1258
1259 /*+SeqScan("
1260
1261
1262 ")*/
1263 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "
1264
1265
1266 " WHERE "
1267
1268
1269 ".c1 = 1;
1270 LOG:  pg_hint_plan:
1271 used hint:
1272 SeqScan("
1273
1274
1275 ")
1276 not used hint:
1277 duplication hint:
1278 error hint:
1279
1280      QUERY PLAN     
1281 --------------------
1282  Seq Scan on t1 "
1283  
1284  
1285  "
1286    Filter: (c1 = 1)
1287 (5 rows)
1288
1289 -- No. A-7-3-9
1290 -- No. A-9-2-9
1291 /*+SeqScan(Set)*/
1292 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
1293 LOG:  pg_hint_plan:
1294 used hint:
1295 SeqScan(Set)
1296 not used hint:
1297 duplication hint:
1298 error hint:
1299
1300       QUERY PLAN      
1301 ----------------------
1302  Seq Scan on t1 "Set"
1303    Filter: (c1 = 1)
1304 (2 rows)
1305
1306 /*+SeqScan("Set")*/
1307 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set" WHERE "Set".c1 = 1;
1308 LOG:  pg_hint_plan:
1309 used hint:
1310 SeqScan(Set)
1311 not used hint:
1312 duplication hint:
1313 error hint:
1314
1315       QUERY PLAN      
1316 ----------------------
1317  Seq Scan on t1 "Set"
1318    Filter: (c1 = 1)
1319 (2 rows)
1320
1321 /*+SeqScan("Set SeqScan Leading")*/
1322 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "Set SeqScan Leading" WHERE "Set SeqScan Leading".c1 = 1;
1323 LOG:  pg_hint_plan:
1324 used hint:
1325 SeqScan("Set SeqScan Leading")
1326 not used hint:
1327 duplication hint:
1328 error hint:
1329
1330               QUERY PLAN              
1331 --------------------------------------
1332  Seq Scan on t1 "Set SeqScan Leading"
1333    Filter: (c1 = 1)
1334 (2 rows)
1335
1336 -- No. A-7-3-10
1337 -- No. A-9-2-10
1338 /*+SeqScan(あ)*/
1339 EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
1340 LOG:  pg_hint_plan:
1341 used hint:
1342 SeqScan(あ)
1343 not used hint:
1344 duplication hint:
1345 error hint:
1346
1347      QUERY PLAN      
1348 ---------------------
1349  Seq Scan on t1 "あ"
1350    Filter: (c1 = 1)
1351 (2 rows)
1352
1353 /*+SeqScan(あいう)*/
1354 EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
1355 LOG:  pg_hint_plan:
1356 used hint:
1357 SeqScan(あいう)
1358 not used hint:
1359 duplication hint:
1360 error hint:
1361
1362        QUERY PLAN        
1363 -------------------------
1364  Seq Scan on t1 "あいう"
1365    Filter: (c1 = 1)
1366 (2 rows)
1367
1368 /*+SeqScan("あ")*/
1369 EXPLAIN (COSTS false) SELECT * FROM s1.t1 あ WHERE あ.c1 = 1;
1370 LOG:  pg_hint_plan:
1371 used hint:
1372 SeqScan(あ)
1373 not used hint:
1374 duplication hint:
1375 error hint:
1376
1377      QUERY PLAN      
1378 ---------------------
1379  Seq Scan on t1 "あ"
1380    Filter: (c1 = 1)
1381 (2 rows)
1382
1383 /*+SeqScan("あいう")*/
1384 EXPLAIN (COSTS false) SELECT * FROM s1.t1 あいう WHERE あいう.c1 = 1;
1385 LOG:  pg_hint_plan:
1386 used hint:
1387 SeqScan(あいう)
1388 not used hint:
1389 duplication hint:
1390 error hint:
1391
1392        QUERY PLAN        
1393 -------------------------
1394  Seq Scan on t1 "あいう"
1395    Filter: (c1 = 1)
1396 (2 rows)
1397
1398 -- No. A-7-3-11
1399 -- No. A-9-2-11
1400 /*+SeqScan(/**/)*/
1401 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;
1402 INFO:  pg_hint_plan: hint syntax error at or near "/**/)*/
1403 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**/" WHERE "/**/".c1 = 1;"
1404 DETAIL:  Nested block comments are not supported.
1405              QUERY PLAN              
1406 -------------------------------------
1407  Index Scan using t1_i1 on t1 "/**/"
1408    Index Cond: (c1 = 1)
1409 (2 rows)
1410
1411 /*+SeqScan(/**//**//**/)*/
1412 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;
1413 INFO:  pg_hint_plan: hint syntax error at or near "/**//**//**/)*/
1414 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "/**//**//**/" WHERE "/**//**//**/".c1 = 1;"
1415 DETAIL:  Nested block comments are not supported.
1416                  QUERY PLAN                  
1417 ---------------------------------------------
1418  Index Scan using t1_i1 on t1 "/**//**//**/"
1419    Index Cond: (c1 = 1)
1420 (2 rows)
1421
1422 -- No. A-7-3-12
1423 -- No. A-9-2-12
1424 /*+SeqScan("tT()""      
1425 Set/**/あ")*/
1426 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""       
1427 Set/**/あ" WHERE "tT()""       
1428 Set/**/あ".c1 = 1;
1429 INFO:  pg_hint_plan: hint syntax error at or near "/**/あ")*/
1430 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""       
1431 Set/**/あ" WHERE "tT()""       
1432 Set/**/あ".c1 = 1;"
1433 DETAIL:  Nested block comments are not supported.
1434                 QUERY PLAN                
1435 ------------------------------------------
1436  Index Scan using t1_i1 on t1 "tT()""    
1437  Set/**/あ"
1438    Index Cond: (c1 = 1)
1439 (3 rows)
1440
1441 --"
1442 /*+SeqScan("tT()""      
1443 Setあ")*/
1444 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "tT()""       
1445 Setあ" WHERE "tT()""   
1446 Setあ".c1 = 1;
1447 LOG:  pg_hint_plan:
1448 used hint:
1449 SeqScan("tT()""         
1450 Setあ")
1451 not used hint:
1452 duplication hint:
1453 error hint:
1454
1455         QUERY PLAN        
1456 --------------------------
1457  Seq Scan on t1 "tT()""  
1458  Setあ"
1459    Filter: (c1 = 1)
1460 (3 rows)
1461
1462 -- No. A-7-3-13
1463 -- No. A-9-2-13
1464 /*+SeqScan(a123456789b123456789c123456789d123456789e123456789f123)*/
1465 EXPLAIN (COSTS false) SELECT * FROM s1.t1 "123456789012345678901234567890123456789012345678901234" WHERE "123456789012345678901234567890123456789012345678901234".c1 = 1;
1466 LOG:  pg_hint_plan:
1467 used hint:
1468 not used hint:
1469 SeqScan(a123456789b123456789c123456789d123456789e123456789f123)
1470 duplication hint:
1471 error hint:
1472
1473                                       QUERY PLAN                                       
1474 ---------------------------------------------------------------------------------------
1475  Index Scan using t1_i1 on t1 "123456789012345678901234567890123456789012345678901234"
1476    Index Cond: (c1 = 1)
1477 (2 rows)
1478
1479 ----
1480 ---- No. A-7-4 hint parse error
1481 ----
1482 -- No. A-7-4-1
1483 /*+Set(enable_indexscan off)Set enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
1484 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1485 INFO:  pg_hint_plan: hint syntax error at or near "enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
1486 DETAIL:  Opening parenthesis is necessary.
1487 LOG:  pg_hint_plan:
1488 used hint:
1489 Set(enable_indexscan off)
1490 not used hint:
1491 duplication hint:
1492 error hint:
1493
1494             QUERY PLAN            
1495 ----------------------------------
1496  Bitmap Heap Scan on t1
1497    Recheck Cond: (c1 = 1)
1498    ->  Bitmap Index Scan on t1_i1
1499          Index Cond: (c1 = 1)
1500 (4 rows)
1501
1502 -- No. A-7-4-2
1503 /*+Set(enable_indexscan off)Set(enable_tidscan off Set(enable_bitmapscan off)SeqScan(t1)*/
1504 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1505 INFO:  pg_hint_plan: hint syntax error at or near "(enable_bitmapscan off)SeqScan(t1)"
1506 DETAIL:  Zero-length delimited string.
1507 LOG:  pg_hint_plan:
1508 used hint:
1509 Set(enable_indexscan off)
1510 not used hint:
1511 duplication hint:
1512 error hint:
1513
1514             QUERY PLAN            
1515 ----------------------------------
1516  Bitmap Heap Scan on t1
1517    Recheck Cond: (c1 = 1)
1518    ->  Bitmap Index Scan on t1_i1
1519          Index Cond: (c1 = 1)
1520 (4 rows)
1521
1522 -- No. A-7-4-3
1523 /*+Set(enable_indexscan off)Set(enable_tidscan "off)Set(enable_bitmapscan off)SeqScan(t1)*/
1524 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1525 INFO:  pg_hint_plan: hint syntax error at or near ""
1526 DETAIL:  Unterminated quoted string.
1527 LOG:  pg_hint_plan:
1528 used hint:
1529 Set(enable_indexscan off)
1530 not used hint:
1531 duplication hint:
1532 error hint:
1533
1534             QUERY PLAN            
1535 ----------------------------------
1536  Bitmap Heap Scan on t1
1537    Recheck Cond: (c1 = 1)
1538    ->  Bitmap Index Scan on t1_i1
1539          Index Cond: (c1 = 1)
1540 (4 rows)
1541
1542 -- No. A-7-4-4
1543 /*+Set(enable_indexscan off)SeqScan("")Set(enable_bitmapscan off)*/
1544 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1545 INFO:  pg_hint_plan: hint syntax error at or near ")Set(enable_bitmapscan off)"
1546 DETAIL:  Zero-length delimited string.
1547 LOG:  pg_hint_plan:
1548 used hint:
1549 Set(enable_indexscan off)
1550 not used hint:
1551 duplication hint:
1552 error hint:
1553
1554             QUERY PLAN            
1555 ----------------------------------
1556  Bitmap Heap Scan on t1
1557    Recheck Cond: (c1 = 1)
1558    ->  Bitmap Index Scan on t1_i1
1559          Index Cond: (c1 = 1)
1560 (4 rows)
1561
1562 -- No. A-7-4-5
1563 /*+Set(enable_indexscan off)NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
1564 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1565 INFO:  pg_hint_plan: hint syntax error at or near "NoSet(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
1566 DETAIL:  Unrecognized hint keyword "NoSet".
1567 LOG:  pg_hint_plan:
1568 used hint:
1569 Set(enable_indexscan off)
1570 not used hint:
1571 duplication hint:
1572 error hint:
1573
1574             QUERY PLAN            
1575 ----------------------------------
1576  Bitmap Heap Scan on t1
1577    Recheck Cond: (c1 = 1)
1578    ->  Bitmap Index Scan on t1_i1
1579          Index Cond: (c1 = 1)
1580 (4 rows)
1581
1582 -- No. A-7-4-6
1583 /*+Set(enable_indexscan off)"Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)*/
1584 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1585 INFO:  pg_hint_plan: hint syntax error at or near ""Set"(enable_tidscan off)Set(enable_bitmapscan off)SeqScan(t1)"
1586 DETAIL:  Unrecognized hint keyword ""Set"".
1587 LOG:  pg_hint_plan:
1588 used hint:
1589 Set(enable_indexscan off)
1590 not used hint:
1591 duplication hint:
1592 error hint:
1593
1594             QUERY PLAN            
1595 ----------------------------------
1596  Bitmap Heap Scan on t1
1597    Recheck Cond: (c1 = 1)
1598    ->  Bitmap Index Scan on t1_i1
1599          Index Cond: (c1 = 1)
1600 (4 rows)
1601
1602 -- No. A-7-4-7
1603 /*+Set(enable_indexscan off)Set(enable_tidscan /* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
1604 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1605 INFO:  pg_hint_plan: hint syntax error at or near "/* value */off)Set(enable_bitmapscan off)SeqScan(t1)*/
1606 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;"
1607 DETAIL:  Nested block comments are not supported.
1608           QUERY PLAN          
1609 ------------------------------
1610  Index Scan using t1_i1 on t1
1611    Index Cond: (c1 = 1)
1612 (2 rows)
1613
1614 ----
1615 ---- No. A-8-1 original GUC parameter
1616 ----
1617 ---- Don't test postgresql itself.
1618 -- No. A-8-1-1
1619 -- SET ROLE super_user;
1620 -- SET pg_hint_plan.debug_print TO off;
1621 -- SHOW pg_hint_plan.enable_hint;
1622 -- SHOW pg_hint_plan.debug_print;
1623 -- SHOW pg_hint_plan.parse_messages;
1624 -- SET pg_hint_plan.enable_hint TO off;
1625 -- SET pg_hint_plan.debug_print TO on;
1626 -- SET pg_hint_plan.parse_messages TO error;
1627 -- SHOW pg_hint_plan.enable_hint;
1628 -- SHOW pg_hint_plan.debug_print;
1629 -- SHOW pg_hint_plan.parse_messages;
1630 -- RESET pg_hint_plan.enable_hint;
1631 -- RESET pg_hint_plan.debug_print;
1632 -- RESET pg_hint_plan.parse_messages;
1633 -- SHOW pg_hint_plan.enable_hint;
1634 -- SHOW pg_hint_plan.debug_print;
1635 -- SHOW pg_hint_plan.parse_messages;
1636 -- 
1637 -- -- No. A-8-1-2
1638 -- SET ROLE normal_user;
1639 -- SHOW pg_hint_plan.enable_hint;
1640 -- SHOW pg_hint_plan.debug_print;
1641 -- SHOW pg_hint_plan.parse_messages;
1642 -- SET pg_hint_plan.enable_hint TO off;
1643 -- SET pg_hint_plan.debug_print TO on;
1644 -- SET pg_hint_plan.parse_messages TO error;
1645 -- SHOW pg_hint_plan.enable_hint;
1646 -- SHOW pg_hint_plan.debug_print;
1647 -- SHOW pg_hint_plan.parse_messages;
1648 -- RESET pg_hint_plan.enable_hint;
1649 -- RESET pg_hint_plan.debug_print;
1650 -- RESET pg_hint_plan.parse_messages;
1651 -- SHOW pg_hint_plan.enable_hint;
1652 -- SHOW pg_hint_plan.debug_print;
1653 -- SHOW pg_hint_plan.parse_messages;
1654 -- 
1655 -- RESET ROLE;
1656 ----
1657 ---- No. A-8-2 original GUC parameter pg_hint_plan.enable_hint
1658 ----
1659 -- No. A-8-2-1
1660 SET pg_hint_plan.debug_print TO off;
1661 SET pg_hint_plan.enable_hint TO on;
1662 SHOW pg_hint_plan.enable_hint;
1663  pg_hint_plan.enable_hint 
1664 --------------------------
1665  on
1666 (1 row)
1667
1668 /*+Set(enable_indexscan off)*/
1669 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1670             QUERY PLAN            
1671 ----------------------------------
1672  Bitmap Heap Scan on t1
1673    Recheck Cond: (c1 = 1)
1674    ->  Bitmap Index Scan on t1_i1
1675          Index Cond: (c1 = 1)
1676 (4 rows)
1677
1678 -- No. A-8-2-2
1679 SET pg_hint_plan.enable_hint TO off;
1680 SHOW pg_hint_plan.enable_hint;
1681  pg_hint_plan.enable_hint 
1682 --------------------------
1683  off
1684 (1 row)
1685
1686 /*+Set(enable_indexscan off)*/
1687 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1688           QUERY PLAN          
1689 ------------------------------
1690  Index Scan using t1_i1 on t1
1691    Index Cond: (c1 = 1)
1692 (2 rows)
1693
1694 -- No. A-8-2-3
1695 -- Don't test PostgreSQL itself.
1696 -- SET pg_hint_plan.enable_hint TO DEFAULT;
1697 -- SHOW pg_hint_plan.enable_hint;
1698 -- /*+Set(enable_indexscan off)*/
1699 -- EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1700 -- No. A-8-2-4
1701 -- Don't test PostgreSQL itself
1702 -- SET pg_hint_plan.enable_hint TO enable;
1703 -- SHOW pg_hint_plan.enable_hint;
1704 ----
1705 ---- No. A-8-3 original GUC parameter pg_hint_plan.debug_print
1706 ----
1707 -- No. A-8-3-1
1708 SET pg_hint_plan.enable_hint TO on;
1709 SHOW pg_hint_plan.enable_hint;
1710  pg_hint_plan.enable_hint 
1711 --------------------------
1712  on
1713 (1 row)
1714
1715 SET pg_hint_plan.debug_print TO on;
1716 SHOW pg_hint_plan.debug_print;
1717  pg_hint_plan.debug_print 
1718 --------------------------
1719  on
1720 (1 row)
1721
1722 /*+Set(enable_indexscan off)*/
1723 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1724 LOG:  pg_hint_plan:
1725 used hint:
1726 Set(enable_indexscan off)
1727 not used hint:
1728 duplication hint:
1729 error hint:
1730
1731             QUERY PLAN            
1732 ----------------------------------
1733  Bitmap Heap Scan on t1
1734    Recheck Cond: (c1 = 1)
1735    ->  Bitmap Index Scan on t1_i1
1736          Index Cond: (c1 = 1)
1737 (4 rows)
1738
1739 -- No. A-8-3-2
1740 SET pg_hint_plan.debug_print TO off;
1741 SHOW pg_hint_plan.debug_print;
1742  pg_hint_plan.debug_print 
1743 --------------------------
1744  off
1745 (1 row)
1746
1747 /*+Set(enable_indexscan off)*/
1748 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1749             QUERY PLAN            
1750 ----------------------------------
1751  Bitmap Heap Scan on t1
1752    Recheck Cond: (c1 = 1)
1753    ->  Bitmap Index Scan on t1_i1
1754          Index Cond: (c1 = 1)
1755 (4 rows)
1756
1757 -- No. A-8-3-3
1758 SET pg_hint_plan.debug_print TO DEFAULT;
1759 SHOW pg_hint_plan.debug_print;
1760  pg_hint_plan.debug_print 
1761 --------------------------
1762  off
1763 (1 row)
1764
1765 /*+Set(enable_indexscan off)*/
1766 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
1767             QUERY PLAN            
1768 ----------------------------------
1769  Bitmap Heap Scan on t1
1770    Recheck Cond: (c1 = 1)
1771    ->  Bitmap Index Scan on t1_i1
1772          Index Cond: (c1 = 1)
1773 (4 rows)
1774
1775 -- No. A-8-3-4
1776 SET pg_hint_plan.debug_print TO enable;
1777 ERROR:  invalid value for parameter "pg_hint_plan.debug_print": "enable"
1778 HINT:  Available values: off, on, detailed, verbose.
1779 SHOW pg_hint_plan.debug_print;
1780  pg_hint_plan.debug_print 
1781 --------------------------
1782  off
1783 (1 row)
1784
1785 ----
1786 ---- No. A-8-4 original GUC parameter pg_hint_plan.parse_messages
1787 ----
1788 SET client_min_messages TO debug5;
1789 DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0
1790 -- No. A-8-4-1
1791 SET pg_hint_plan.parse_messages TO debug5;
1792 DEBUG:  StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0
1793 DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0
1794 SHOW pg_hint_plan.parse_messages;
1795 DEBUG:  StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0
1796 DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0
1797  pg_hint_plan.parse_messages 
1798 -----------------------------
1799  debug5
1800 (1 row)
1801
1802 /*+Set*/SELECT 1;
1803 DEBUG:  StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0
1804 DEBUG:  pg_hint_plan: hint syntax error at or near ""
1805 DETAIL:  Opening parenthesis is necessary.
1806 DEBUG:  CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGR, xid/subid/cid: 0/1/0
1807  ?column? 
1808 ----------
1809         1
1810 (1 row)
1811
1812 SET client_min_messages TO debug4;
1813 DEBUG:  StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0
1814 /*+Set*/SELECT 1;
1815  ?column? 
1816 ----------
1817         1
1818 (1 row)
1819
1820 -- No. A-8-4-2
1821 SET pg_hint_plan.parse_messages TO debug4;
1822 SHOW pg_hint_plan.parse_messages;
1823  pg_hint_plan.parse_messages 
1824 -----------------------------
1825  debug4
1826 (1 row)
1827
1828 /*+Set*/SELECT 1;
1829 DEBUG:  pg_hint_plan: hint syntax error at or near ""
1830 DETAIL:  Opening parenthesis is necessary.
1831  ?column? 
1832 ----------
1833         1
1834 (1 row)
1835
1836 SET client_min_messages TO debug3;
1837 /*+Set*/SELECT 1;
1838  ?column? 
1839 ----------
1840         1
1841 (1 row)
1842
1843 -- No. A-8-4-3
1844 SET pg_hint_plan.parse_messages TO debug3;
1845 SHOW pg_hint_plan.parse_messages;
1846  pg_hint_plan.parse_messages 
1847 -----------------------------
1848  debug3
1849 (1 row)
1850
1851 /*+Set*/SELECT 1;
1852 DEBUG:  pg_hint_plan: hint syntax error at or near ""
1853 DETAIL:  Opening parenthesis is necessary.
1854  ?column? 
1855 ----------
1856         1
1857 (1 row)
1858
1859 SET client_min_messages TO debug2;
1860 /*+Set*/SELECT 1;
1861  ?column? 
1862 ----------
1863         1
1864 (1 row)
1865
1866 -- No. A-8-4-4
1867 SET pg_hint_plan.parse_messages TO debug2;
1868 SHOW pg_hint_plan.parse_messages;
1869  pg_hint_plan.parse_messages 
1870 -----------------------------
1871  debug
1872 (1 row)
1873
1874 /*+Set*/SELECT 1;
1875 DEBUG:  pg_hint_plan: hint syntax error at or near ""
1876 DETAIL:  Opening parenthesis is necessary.
1877  ?column? 
1878 ----------
1879         1
1880 (1 row)
1881
1882 SET client_min_messages TO debug1;
1883 /*+Set*/SELECT 1;
1884  ?column? 
1885 ----------
1886         1
1887 (1 row)
1888
1889 -- No. A-8-4-5
1890 SET pg_hint_plan.parse_messages TO debug1;
1891 SHOW pg_hint_plan.parse_messages;
1892  pg_hint_plan.parse_messages 
1893 -----------------------------
1894  debug1
1895 (1 row)
1896
1897 /*+Set*/SELECT 1;
1898 DEBUG:  pg_hint_plan: hint syntax error at or near ""
1899 DETAIL:  Opening parenthesis is necessary.
1900  ?column? 
1901 ----------
1902         1
1903 (1 row)
1904
1905 SET client_min_messages TO log;
1906 /*+Set*/SELECT 1;
1907  ?column? 
1908 ----------
1909         1
1910 (1 row)
1911
1912 -- No. A-8-4-6
1913 SET pg_hint_plan.parse_messages TO log;
1914 SHOW pg_hint_plan.parse_messages;
1915  pg_hint_plan.parse_messages 
1916 -----------------------------
1917  log
1918 (1 row)
1919
1920 /*+Set*/SELECT 1;
1921 LOG:  pg_hint_plan: hint syntax error at or near ""
1922 DETAIL:  Opening parenthesis is necessary.
1923  ?column? 
1924 ----------
1925         1
1926 (1 row)
1927
1928 SET client_min_messages TO info;
1929 /*+Set*/SELECT 1;
1930  ?column? 
1931 ----------
1932         1
1933 (1 row)
1934
1935 -- No. A-8-4-7
1936 SET pg_hint_plan.parse_messages TO info;
1937 SHOW pg_hint_plan.parse_messages;
1938  pg_hint_plan.parse_messages 
1939 -----------------------------
1940  info
1941 (1 row)
1942
1943 /*+Set*/SELECT 1;
1944 INFO:  pg_hint_plan: hint syntax error at or near ""
1945 DETAIL:  Opening parenthesis is necessary.
1946  ?column? 
1947 ----------
1948         1
1949 (1 row)
1950
1951 SET client_min_messages TO notice;
1952 /*+Set*/SELECT 1;
1953 INFO:  pg_hint_plan: hint syntax error at or near ""
1954 DETAIL:  Opening parenthesis is necessary.
1955  ?column? 
1956 ----------
1957         1
1958 (1 row)
1959
1960 -- No. A-8-4-8
1961 SET pg_hint_plan.parse_messages TO notice;
1962 SHOW pg_hint_plan.parse_messages;
1963  pg_hint_plan.parse_messages 
1964 -----------------------------
1965  notice
1966 (1 row)
1967
1968 /*+Set*/SELECT 1;
1969 NOTICE:  pg_hint_plan: hint syntax error at or near ""
1970 DETAIL:  Opening parenthesis is necessary.
1971  ?column? 
1972 ----------
1973         1
1974 (1 row)
1975
1976 SET client_min_messages TO warning;
1977 /*+Set*/SELECT 1;
1978  ?column? 
1979 ----------
1980         1
1981 (1 row)
1982
1983 -- No. A-8-4-9
1984 SET pg_hint_plan.parse_messages TO warning;
1985 SHOW pg_hint_plan.parse_messages;
1986  pg_hint_plan.parse_messages 
1987 -----------------------------
1988  warning
1989 (1 row)
1990
1991 /*+Set*/SELECT 1;
1992 WARNING:  pg_hint_plan: hint syntax error at or near ""
1993 DETAIL:  Opening parenthesis is necessary.
1994  ?column? 
1995 ----------
1996         1
1997 (1 row)
1998
1999 SET client_min_messages TO error;
2000 /*+Set*/SELECT 1;
2001  ?column? 
2002 ----------
2003         1
2004 (1 row)
2005
2006 -- No. A-8-4-10
2007 SET pg_hint_plan.parse_messages TO error;
2008 SHOW pg_hint_plan.parse_messages;
2009  pg_hint_plan.parse_messages 
2010 -----------------------------
2011  error
2012 (1 row)
2013
2014 /*+Set*/SELECT 1;
2015 ERROR:  pg_hint_plan: hint syntax error at or near ""
2016 DETAIL:  Opening parenthesis is necessary.
2017 SET client_min_messages TO fatal;
2018 /*+Set*/SELECT 1;
2019 ERROR:  pg_hint_plan: hint syntax error at or near ""
2020 DETAIL:  Opening parenthesis is necessary.
2021 -- No. A-8-4-11
2022 RESET client_min_messages;
2023 SET pg_hint_plan.parse_messages TO DEFAULT;
2024 SHOW pg_hint_plan.parse_messages;
2025  pg_hint_plan.parse_messages 
2026 -----------------------------
2027  info
2028 (1 row)
2029
2030 /*+Set*/SELECT 1;
2031 INFO:  pg_hint_plan: hint syntax error at or near ""
2032 DETAIL:  Opening parenthesis is necessary.
2033  ?column? 
2034 ----------
2035         1
2036 (1 row)
2037
2038 -- No. A-8-4-12
2039 SET pg_hint_plan.parse_messages TO fatal;
2040 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "fatal"
2041 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
2042 SHOW pg_hint_plan.parse_messages;
2043  pg_hint_plan.parse_messages 
2044 -----------------------------
2045  info
2046 (1 row)
2047
2048 -- No. A-8-4-13
2049 SET pg_hint_plan.parse_messages TO panic;
2050 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "panic"
2051 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
2052 SHOW pg_hint_plan.parse_messages;
2053  pg_hint_plan.parse_messages 
2054 -----------------------------
2055  info
2056 (1 row)
2057
2058 -- No. A-8-4-14
2059 SET pg_hint_plan.parse_messages TO on;
2060 ERROR:  invalid value for parameter "pg_hint_plan.parse_messages": "on"
2061 HINT:  Available values: debug5, debug4, debug3, debug2, debug1, log, info, notice, warning, error.
2062 SHOW pg_hint_plan.parse_messages;
2063  pg_hint_plan.parse_messages 
2064 -----------------------------
2065  info
2066 (1 row)
2067
2068 ----
2069 ---- No. A-8-5 original GUC parameter pg_hint_plan.enable_hint_table
2070 ----
2071 INSERT INTO hint_plan.hints (norm_query_string, application_name, hints)
2072         VALUES (
2073         'EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = ?;',
2074         '',
2075         'SeqScan(t1)');
2076 -- No. A-8-5-1
2077 SET pg_hint_plan.enable_hint_table TO on;
2078 SHOW pg_hint_plan.enable_hint_table;
2079  pg_hint_plan.enable_hint_table 
2080 --------------------------------
2081  on
2082 (1 row)
2083
2084 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2085      QUERY PLAN     
2086 --------------------
2087  Seq Scan on t1
2088    Filter: (c1 = 1)
2089 (2 rows)
2090
2091 -- No. A-8-5-2
2092 SET pg_hint_plan.enable_hint_table TO off;
2093 SHOW pg_hint_plan.enable_hint_table;
2094  pg_hint_plan.enable_hint_table 
2095 --------------------------------
2096  off
2097 (1 row)
2098
2099 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2100           QUERY PLAN          
2101 ------------------------------
2102  Index Scan using t1_i1 on t1
2103    Index Cond: (c1 = 1)
2104 (2 rows)
2105
2106 -- No. A-8-5-3
2107 SET pg_hint_plan.enable_hint_table TO DEFAULT;
2108 SHOW pg_hint_plan.enable_hint_table;
2109  pg_hint_plan.enable_hint_table 
2110 --------------------------------
2111  off
2112 (1 row)
2113
2114 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2115           QUERY PLAN          
2116 ------------------------------
2117  Index Scan using t1_i1 on t1
2118    Index Cond: (c1 = 1)
2119 (2 rows)
2120
2121 -- No. A-8-5-4
2122 SET pg_hint_plan.enable_hint_table TO enable;
2123 ERROR:  parameter "pg_hint_plan.enable_hint_table" requires a Boolean value
2124 SHOW pg_hint_plan.enable_hint_table;
2125  pg_hint_plan.enable_hint_table 
2126 --------------------------------
2127  off
2128 (1 row)
2129
2130 TRUNCATE hint_plan.hints;
2131 ----
2132 ---- No. A-9-1 parse error message output
2133 ----
2134 -- No. A-9-1-1
2135 /*+"Set"(enable_indexscan on)*/SELECT 1;
2136 INFO:  pg_hint_plan: hint syntax error at or near ""Set"(enable_indexscan on)"
2137 DETAIL:  Unrecognized hint keyword ""Set"".
2138  ?column? 
2139 ----------
2140         1
2141 (1 row)
2142
2143 /*+Set()(enable_indexscan on)*/SELECT 1;
2144 INFO:  pg_hint_plan: hint syntax error at or near "Set()(enable_indexscan on)"
2145 DETAIL:  Set hint requires name and value of GUC parameter.
2146 INFO:  pg_hint_plan: hint syntax error at or near "(enable_indexscan on)"
2147 DETAIL:  Unrecognized hint keyword "".
2148  ?column? 
2149 ----------
2150         1
2151 (1 row)
2152
2153 /*+Set(enable_indexscan on*/SELECT 1;
2154 INFO:  pg_hint_plan: hint syntax error at or near ""
2155 DETAIL:  Closing parenthesis is necessary.
2156  ?column? 
2157 ----------
2158         1
2159 (1 row)
2160
2161 ----
2162 ---- No. A-9-3 hint state output
2163 ----
2164 SET pg_hint_plan.debug_print TO on;
2165 SET client_min_messages TO LOG;
2166 -- No. A-9-3-1
2167 /*+SeqScan(t1)*/
2168 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2169 LOG:  pg_hint_plan:
2170 used hint:
2171 SeqScan(t1)
2172 not used hint:
2173 duplication hint:
2174 error hint:
2175
2176      QUERY PLAN     
2177 --------------------
2178  Seq Scan on t1
2179    Filter: (c1 = 1)
2180 (2 rows)
2181
2182 -- No. A-9-3-2
2183 /*+SeqScan(no_table)*/
2184 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2185 LOG:  pg_hint_plan:
2186 used hint:
2187 not used hint:
2188 SeqScan(no_table)
2189 duplication hint:
2190 error hint:
2191
2192           QUERY PLAN          
2193 ------------------------------
2194  Index Scan using t1_i1 on t1
2195    Index Cond: (c1 = 1)
2196 (2 rows)
2197
2198 -- No. A-9-3-3
2199 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
2200             QUERY PLAN             
2201 -----------------------------------
2202  Tid Scan on t1
2203    TID Cond: (ctid = '(1,1)'::tid)
2204    Filter: (c1 = 1)
2205 (3 rows)
2206
2207 /*+TidScan(t1)BitmapScan(t1)*/
2208 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
2209 INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)"
2210 DETAIL:  Conflict scan method hint.
2211 LOG:  pg_hint_plan:
2212 used hint:
2213 BitmapScan(t1)
2214 not used hint:
2215 duplication hint:
2216 TidScan(t1)
2217 error hint:
2218
2219             QUERY PLAN            
2220 ----------------------------------
2221  Bitmap Heap Scan on t1
2222    Recheck Cond: (c1 = 1)
2223    Filter: (ctid = '(1,1)'::tid)
2224    ->  Bitmap Index Scan on t1_i1
2225          Index Cond: (c1 = 1)
2226 (5 rows)
2227
2228 /*+TidScan(t1)BitmapScan(t1)IndexScan(t1)*/
2229 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
2230 INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)"
2231 DETAIL:  Conflict scan method hint.
2232 INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)"
2233 DETAIL:  Conflict scan method hint.
2234 LOG:  pg_hint_plan:
2235 used hint:
2236 IndexScan(t1)
2237 not used hint:
2238 duplication hint:
2239 TidScan(t1)
2240 BitmapScan(t1)
2241 error hint:
2242
2243            QUERY PLAN            
2244 ---------------------------------
2245  Index Scan using t1_i1 on t1
2246    Index Cond: (c1 = 1)
2247    Filter: (ctid = '(1,1)'::tid)
2248 (3 rows)
2249
2250 /*+TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)*/
2251 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1 AND t1.ctid = '(1,1)';
2252 INFO:  pg_hint_plan: hint syntax error at or near "TidScan(t1)BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
2253 DETAIL:  Conflict scan method hint.
2254 INFO:  pg_hint_plan: hint syntax error at or near "BitmapScan(t1)IndexScan(t1)SeqScan(t1)"
2255 DETAIL:  Conflict scan method hint.
2256 INFO:  pg_hint_plan: hint syntax error at or near "IndexScan(t1)SeqScan(t1)"
2257 DETAIL:  Conflict scan method hint.
2258 LOG:  pg_hint_plan:
2259 used hint:
2260 SeqScan(t1)
2261 not used hint:
2262 duplication hint:
2263 TidScan(t1)
2264 BitmapScan(t1)
2265 IndexScan(t1)
2266 error hint:
2267
2268                    QUERY PLAN                   
2269 ------------------------------------------------
2270  Seq Scan on t1
2271    Filter: ((c1 = 1) AND (ctid = '(1,1)'::tid))
2272 (2 rows)
2273
2274 -- No. A-9-3-4
2275 /*+Set(enable_indexscan enable)*/
2276 EXPLAIN (COSTS false) SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2277 INFO:  parameter "enable_indexscan" requires a Boolean value
2278 LOG:  pg_hint_plan:
2279 used hint:
2280 not used hint:
2281 duplication hint:
2282 error hint:
2283 Set(enable_indexscan enable)
2284
2285           QUERY PLAN          
2286 ------------------------------
2287  Index Scan using t1_i1 on t1
2288    Index Cond: (c1 = 1)
2289 (2 rows)
2290
2291 ----
2292 ---- No. A-10-1 hint state output
2293 ----
2294 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2295 EXPLAIN (COSTS false) EXECUTE p1;
2296           QUERY PLAN          
2297 ------------------------------
2298  Index Scan using t1_i1 on t1
2299    Index Cond: (c1 = 1)
2300 (2 rows)
2301
2302 DEALLOCATE p1;
2303 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2304 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2305       QUERY PLAN       
2306 -----------------------
2307  Seq Scan on t1
2308    Filter: (c1 < 1000)
2309 (2 rows)
2310
2311 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2312       QUERY PLAN       
2313 -----------------------
2314  Seq Scan on t1
2315    Filter: (c1 < 1000)
2316 (2 rows)
2317
2318 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2319       QUERY PLAN       
2320 -----------------------
2321  Seq Scan on t1
2322    Filter: (c1 < 1000)
2323 (2 rows)
2324
2325 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2326       QUERY PLAN       
2327 -----------------------
2328  Seq Scan on t1
2329    Filter: (c1 < 1000)
2330 (2 rows)
2331
2332 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2333       QUERY PLAN       
2334 -----------------------
2335  Seq Scan on t1
2336    Filter: (c1 < 1000)
2337 (2 rows)
2338
2339 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2340      QUERY PLAN      
2341 ---------------------
2342  Seq Scan on t1
2343    Filter: (c1 < $1)
2344 (2 rows)
2345
2346 DEALLOCATE p1;
2347 -- No. A-10-1-1
2348 -- No. A-10-1-2
2349 /*+SeqScan(t1)*/
2350 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2351 /*+BitmapScan(t1)*/
2352 EXPLAIN (COSTS false) EXECUTE p1;
2353 LOG:  pg_hint_plan:
2354 used hint:
2355 SeqScan(t1)
2356 not used hint:
2357 duplication hint:
2358 error hint:
2359
2360      QUERY PLAN     
2361 --------------------
2362  Seq Scan on t1
2363    Filter: (c1 = 1)
2364 (2 rows)
2365
2366 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2367 /*+BitmapScan(t1)*/
2368 EXPLAIN (COSTS false) EXECUTE p1;
2369 LOG:  pg_hint_plan:
2370 used hint:
2371 SeqScan(t1)
2372 not used hint:
2373 duplication hint:
2374 error hint:
2375
2376      QUERY PLAN     
2377 --------------------
2378  Seq Scan on t1
2379    Filter: (c1 = 1)
2380 (2 rows)
2381
2382 DEALLOCATE p1;
2383 /*+BitmapScan(t1)*/
2384 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2385 /*+SeqScan(t1)*/
2386 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2387 LOG:  pg_hint_plan:
2388 used hint:
2389 BitmapScan(t1)
2390 not used hint:
2391 duplication hint:
2392 error hint:
2393
2394             QUERY PLAN            
2395 ----------------------------------
2396  Bitmap Heap Scan on t1
2397    Recheck Cond: (c1 < 1000)
2398    ->  Bitmap Index Scan on t1_i1
2399          Index Cond: (c1 < 1000)
2400 (4 rows)
2401
2402 /*+SeqScan(t1)*/
2403 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2404 LOG:  pg_hint_plan:
2405 used hint:
2406 BitmapScan(t1)
2407 not used hint:
2408 duplication hint:
2409 error hint:
2410
2411             QUERY PLAN            
2412 ----------------------------------
2413  Bitmap Heap Scan on t1
2414    Recheck Cond: (c1 < 1000)
2415    ->  Bitmap Index Scan on t1_i1
2416          Index Cond: (c1 < 1000)
2417 (4 rows)
2418
2419 /*+SeqScan(t1)*/
2420 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2421 LOG:  pg_hint_plan:
2422 used hint:
2423 BitmapScan(t1)
2424 not used hint:
2425 duplication hint:
2426 error hint:
2427
2428             QUERY PLAN            
2429 ----------------------------------
2430  Bitmap Heap Scan on t1
2431    Recheck Cond: (c1 < 1000)
2432    ->  Bitmap Index Scan on t1_i1
2433          Index Cond: (c1 < 1000)
2434 (4 rows)
2435
2436 /*+SeqScan(t1)*/
2437 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2438 LOG:  pg_hint_plan:
2439 used hint:
2440 BitmapScan(t1)
2441 not used hint:
2442 duplication hint:
2443 error hint:
2444
2445             QUERY PLAN            
2446 ----------------------------------
2447  Bitmap Heap Scan on t1
2448    Recheck Cond: (c1 < 1000)
2449    ->  Bitmap Index Scan on t1_i1
2450          Index Cond: (c1 < 1000)
2451 (4 rows)
2452
2453 /*+SeqScan(t1)*/
2454 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2455 LOG:  pg_hint_plan:
2456 used hint:
2457 BitmapScan(t1)
2458 not used hint:
2459 duplication hint:
2460 error hint:
2461
2462             QUERY PLAN            
2463 ----------------------------------
2464  Bitmap Heap Scan on t1
2465    Recheck Cond: (c1 < 1000)
2466    ->  Bitmap Index Scan on t1_i1
2467          Index Cond: (c1 < 1000)
2468 (4 rows)
2469
2470 /*+SeqScan(t1)*/
2471 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2472 LOG:  pg_hint_plan:
2473 used hint:
2474 BitmapScan(t1)
2475 not used hint:
2476 duplication hint:
2477 error hint:
2478
2479             QUERY PLAN            
2480 ----------------------------------
2481  Bitmap Heap Scan on t1
2482    Recheck Cond: (c1 < $1)
2483    ->  Bitmap Index Scan on t1_i1
2484          Index Cond: (c1 < $1)
2485 (4 rows)
2486
2487 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2488 /*+SeqScan(t1)*/
2489 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2490 LOG:  pg_hint_plan:
2491 used hint:
2492 BitmapScan(t1)
2493 not used hint:
2494 duplication hint:
2495 error hint:
2496
2497             QUERY PLAN            
2498 ----------------------------------
2499  Bitmap Heap Scan on t1
2500    Recheck Cond: (c1 < $1)
2501    ->  Bitmap Index Scan on t1_i1
2502          Index Cond: (c1 < $1)
2503 (4 rows)
2504
2505 DEALLOCATE p1;
2506 -- No. A-10-1-3
2507 -- No. A-10-1-4
2508 /*+SeqScan(t1)*/
2509 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2510 EXPLAIN (COSTS false) EXECUTE p1;
2511 LOG:  pg_hint_plan:
2512 used hint:
2513 SeqScan(t1)
2514 not used hint:
2515 duplication hint:
2516 error hint:
2517
2518      QUERY PLAN     
2519 --------------------
2520  Seq Scan on t1
2521    Filter: (c1 = 1)
2522 (2 rows)
2523
2524 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2525 EXPLAIN (COSTS false) EXECUTE p1;
2526 LOG:  pg_hint_plan:
2527 used hint:
2528 SeqScan(t1)
2529 not used hint:
2530 duplication hint:
2531 error hint:
2532
2533      QUERY PLAN     
2534 --------------------
2535  Seq Scan on t1
2536    Filter: (c1 = 1)
2537 (2 rows)
2538
2539 DEALLOCATE p1;
2540 /*+BitmapScan(t1)*/
2541 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2542 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2543 LOG:  pg_hint_plan:
2544 used hint:
2545 BitmapScan(t1)
2546 not used hint:
2547 duplication hint:
2548 error hint:
2549
2550             QUERY PLAN            
2551 ----------------------------------
2552  Bitmap Heap Scan on t1
2553    Recheck Cond: (c1 < 1000)
2554    ->  Bitmap Index Scan on t1_i1
2555          Index Cond: (c1 < 1000)
2556 (4 rows)
2557
2558 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2559 LOG:  pg_hint_plan:
2560 used hint:
2561 BitmapScan(t1)
2562 not used hint:
2563 duplication hint:
2564 error hint:
2565
2566             QUERY PLAN            
2567 ----------------------------------
2568  Bitmap Heap Scan on t1
2569    Recheck Cond: (c1 < 1000)
2570    ->  Bitmap Index Scan on t1_i1
2571          Index Cond: (c1 < 1000)
2572 (4 rows)
2573
2574 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2575 LOG:  pg_hint_plan:
2576 used hint:
2577 BitmapScan(t1)
2578 not used hint:
2579 duplication hint:
2580 error hint:
2581
2582             QUERY PLAN            
2583 ----------------------------------
2584  Bitmap Heap Scan on t1
2585    Recheck Cond: (c1 < 1000)
2586    ->  Bitmap Index Scan on t1_i1
2587          Index Cond: (c1 < 1000)
2588 (4 rows)
2589
2590 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2591 LOG:  pg_hint_plan:
2592 used hint:
2593 BitmapScan(t1)
2594 not used hint:
2595 duplication hint:
2596 error hint:
2597
2598             QUERY PLAN            
2599 ----------------------------------
2600  Bitmap Heap Scan on t1
2601    Recheck Cond: (c1 < 1000)
2602    ->  Bitmap Index Scan on t1_i1
2603          Index Cond: (c1 < 1000)
2604 (4 rows)
2605
2606 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2607 LOG:  pg_hint_plan:
2608 used hint:
2609 BitmapScan(t1)
2610 not used hint:
2611 duplication hint:
2612 error hint:
2613
2614             QUERY PLAN            
2615 ----------------------------------
2616  Bitmap Heap Scan on t1
2617    Recheck Cond: (c1 < 1000)
2618    ->  Bitmap Index Scan on t1_i1
2619          Index Cond: (c1 < 1000)
2620 (4 rows)
2621
2622 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2623 LOG:  pg_hint_plan:
2624 used hint:
2625 BitmapScan(t1)
2626 not used hint:
2627 duplication hint:
2628 error hint:
2629
2630             QUERY PLAN            
2631 ----------------------------------
2632  Bitmap Heap Scan on t1
2633    Recheck Cond: (c1 < $1)
2634    ->  Bitmap Index Scan on t1_i1
2635          Index Cond: (c1 < $1)
2636 (4 rows)
2637
2638 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2639 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2640 LOG:  pg_hint_plan:
2641 used hint:
2642 BitmapScan(t1)
2643 not used hint:
2644 duplication hint:
2645 error hint:
2646
2647             QUERY PLAN            
2648 ----------------------------------
2649  Bitmap Heap Scan on t1
2650    Recheck Cond: (c1 < $1)
2651    ->  Bitmap Index Scan on t1_i1
2652          Index Cond: (c1 < $1)
2653 (4 rows)
2654
2655 DEALLOCATE p1;
2656 -- No. A-10-1-5
2657 -- No. A-10-1-6
2658 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2659 /*+BitmapScan(t1)*/
2660 EXPLAIN (COSTS false) EXECUTE p1;
2661           QUERY PLAN          
2662 ------------------------------
2663  Index Scan using t1_i1 on t1
2664    Index Cond: (c1 = 1)
2665 (2 rows)
2666
2667 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2668 /*+BitmapScan(t1)*/
2669 EXPLAIN (COSTS false) EXECUTE p1;
2670           QUERY PLAN          
2671 ------------------------------
2672  Index Scan using t1_i1 on t1
2673    Index Cond: (c1 = 1)
2674 (2 rows)
2675
2676 DEALLOCATE p1;
2677 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2678 /*+BitmapScan(t1)*/
2679 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2680       QUERY PLAN       
2681 -----------------------
2682  Seq Scan on t1
2683    Filter: (c1 < 1000)
2684 (2 rows)
2685
2686 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2687       QUERY PLAN       
2688 -----------------------
2689  Seq Scan on t1
2690    Filter: (c1 < 1000)
2691 (2 rows)
2692
2693 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2694       QUERY PLAN       
2695 -----------------------
2696  Seq Scan on t1
2697    Filter: (c1 < 1000)
2698 (2 rows)
2699
2700 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2701       QUERY PLAN       
2702 -----------------------
2703  Seq Scan on t1
2704    Filter: (c1 < 1000)
2705 (2 rows)
2706
2707 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2708       QUERY PLAN       
2709 -----------------------
2710  Seq Scan on t1
2711    Filter: (c1 < 1000)
2712 (2 rows)
2713
2714 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2715      QUERY PLAN      
2716 ---------------------
2717  Seq Scan on t1
2718    Filter: (c1 < $1)
2719 (2 rows)
2720
2721 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2722 /*+BitmapScan(t1)*/
2723 EXPLAIN (COSTS false) EXECUTE p1 (1000);
2724      QUERY PLAN      
2725 ---------------------
2726  Seq Scan on t1
2727    Filter: (c1 < $1)
2728 (2 rows)
2729
2730 DEALLOCATE p1;
2731 -- No. A-10-1-9
2732 -- No. A-10-1-10
2733 /*+SeqScan(t1)*/
2734 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2735 /*+BitmapScan(t1)*/
2736 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
2737 LOG:  pg_hint_plan:
2738 used hint:
2739 SeqScan(t1)
2740 not used hint:
2741 duplication hint:
2742 error hint:
2743
2744      QUERY PLAN     
2745 --------------------
2746  Seq Scan on t1
2747    Filter: (c1 = 1)
2748 (2 rows)
2749
2750 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2751 /*+BitmapScan(t1)*/
2752 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
2753 LOG:  pg_hint_plan:
2754 used hint:
2755 SeqScan(t1)
2756 not used hint:
2757 duplication hint:
2758 error hint:
2759
2760      QUERY PLAN     
2761 --------------------
2762  Seq Scan on t1
2763    Filter: (c1 = 1)
2764 (2 rows)
2765
2766 DEALLOCATE p1;
2767 /*+BitmapScan(t1)*/
2768 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2769 /*+SeqScan(t1)*/
2770 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2771 LOG:  pg_hint_plan:
2772 used hint:
2773 BitmapScan(t1)
2774 not used hint:
2775 duplication hint:
2776 error hint:
2777
2778             QUERY PLAN            
2779 ----------------------------------
2780  Bitmap Heap Scan on t1
2781    Recheck Cond: (c1 < 1000)
2782    ->  Bitmap Index Scan on t1_i1
2783          Index Cond: (c1 < 1000)
2784 (4 rows)
2785
2786 /*+SeqScan(t1)*/
2787 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2788 LOG:  pg_hint_plan:
2789 used hint:
2790 BitmapScan(t1)
2791 not used hint:
2792 duplication hint:
2793 error hint:
2794
2795             QUERY PLAN            
2796 ----------------------------------
2797  Bitmap Heap Scan on t1
2798    Recheck Cond: (c1 < 1000)
2799    ->  Bitmap Index Scan on t1_i1
2800          Index Cond: (c1 < 1000)
2801 (4 rows)
2802
2803 /*+SeqScan(t1)*/
2804 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2805 LOG:  pg_hint_plan:
2806 used hint:
2807 BitmapScan(t1)
2808 not used hint:
2809 duplication hint:
2810 error hint:
2811
2812             QUERY PLAN            
2813 ----------------------------------
2814  Bitmap Heap Scan on t1
2815    Recheck Cond: (c1 < 1000)
2816    ->  Bitmap Index Scan on t1_i1
2817          Index Cond: (c1 < 1000)
2818 (4 rows)
2819
2820 /*+SeqScan(t1)*/
2821 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2822 LOG:  pg_hint_plan:
2823 used hint:
2824 BitmapScan(t1)
2825 not used hint:
2826 duplication hint:
2827 error hint:
2828
2829             QUERY PLAN            
2830 ----------------------------------
2831  Bitmap Heap Scan on t1
2832    Recheck Cond: (c1 < 1000)
2833    ->  Bitmap Index Scan on t1_i1
2834          Index Cond: (c1 < 1000)
2835 (4 rows)
2836
2837 /*+SeqScan(t1)*/
2838 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2839 LOG:  pg_hint_plan:
2840 used hint:
2841 BitmapScan(t1)
2842 not used hint:
2843 duplication hint:
2844 error hint:
2845
2846             QUERY PLAN            
2847 ----------------------------------
2848  Bitmap Heap Scan on t1
2849    Recheck Cond: (c1 < 1000)
2850    ->  Bitmap Index Scan on t1_i1
2851          Index Cond: (c1 < 1000)
2852 (4 rows)
2853
2854 /*+SeqScan(t1)*/
2855 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2856 LOG:  pg_hint_plan:
2857 used hint:
2858 BitmapScan(t1)
2859 not used hint:
2860 duplication hint:
2861 error hint:
2862
2863             QUERY PLAN            
2864 ----------------------------------
2865  Bitmap Heap Scan on t1
2866    Recheck Cond: (c1 < $1)
2867    ->  Bitmap Index Scan on t1_i1
2868          Index Cond: (c1 < $1)
2869 (4 rows)
2870
2871 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2872 /*+SeqScan(t1)*/
2873 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2874 LOG:  pg_hint_plan:
2875 used hint:
2876 BitmapScan(t1)
2877 not used hint:
2878 duplication hint:
2879 error hint:
2880
2881             QUERY PLAN            
2882 ----------------------------------
2883  Bitmap Heap Scan on t1
2884    Recheck Cond: (c1 < $1)
2885    ->  Bitmap Index Scan on t1_i1
2886          Index Cond: (c1 < $1)
2887 (4 rows)
2888
2889 DEALLOCATE p1;
2890 -- No. A-10-1-11
2891 -- No. A-10-1-12
2892 /*+SeqScan(t1)*/
2893 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
2894 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
2895 LOG:  pg_hint_plan:
2896 used hint:
2897 SeqScan(t1)
2898 not used hint:
2899 duplication hint:
2900 error hint:
2901
2902      QUERY PLAN     
2903 --------------------
2904  Seq Scan on t1
2905    Filter: (c1 = 1)
2906 (2 rows)
2907
2908 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
2909 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
2910 LOG:  pg_hint_plan:
2911 used hint:
2912 SeqScan(t1)
2913 not used hint:
2914 duplication hint:
2915 error hint:
2916
2917      QUERY PLAN     
2918 --------------------
2919  Seq Scan on t1
2920    Filter: (c1 = 1)
2921 (2 rows)
2922
2923 DEALLOCATE p1;
2924 /*+BitmapScan(t1)*/
2925 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
2926 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2927 LOG:  pg_hint_plan:
2928 used hint:
2929 BitmapScan(t1)
2930 not used hint:
2931 duplication hint:
2932 error hint:
2933
2934             QUERY PLAN            
2935 ----------------------------------
2936  Bitmap Heap Scan on t1
2937    Recheck Cond: (c1 < 1000)
2938    ->  Bitmap Index Scan on t1_i1
2939          Index Cond: (c1 < 1000)
2940 (4 rows)
2941
2942 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2943 LOG:  pg_hint_plan:
2944 used hint:
2945 BitmapScan(t1)
2946 not used hint:
2947 duplication hint:
2948 error hint:
2949
2950             QUERY PLAN            
2951 ----------------------------------
2952  Bitmap Heap Scan on t1
2953    Recheck Cond: (c1 < 1000)
2954    ->  Bitmap Index Scan on t1_i1
2955          Index Cond: (c1 < 1000)
2956 (4 rows)
2957
2958 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2959 LOG:  pg_hint_plan:
2960 used hint:
2961 BitmapScan(t1)
2962 not used hint:
2963 duplication hint:
2964 error hint:
2965
2966             QUERY PLAN            
2967 ----------------------------------
2968  Bitmap Heap Scan on t1
2969    Recheck Cond: (c1 < 1000)
2970    ->  Bitmap Index Scan on t1_i1
2971          Index Cond: (c1 < 1000)
2972 (4 rows)
2973
2974 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2975 LOG:  pg_hint_plan:
2976 used hint:
2977 BitmapScan(t1)
2978 not used hint:
2979 duplication hint:
2980 error hint:
2981
2982             QUERY PLAN            
2983 ----------------------------------
2984  Bitmap Heap Scan on t1
2985    Recheck Cond: (c1 < 1000)
2986    ->  Bitmap Index Scan on t1_i1
2987          Index Cond: (c1 < 1000)
2988 (4 rows)
2989
2990 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
2991 LOG:  pg_hint_plan:
2992 used hint:
2993 BitmapScan(t1)
2994 not used hint:
2995 duplication hint:
2996 error hint:
2997
2998             QUERY PLAN            
2999 ----------------------------------
3000  Bitmap Heap Scan on t1
3001    Recheck Cond: (c1 < 1000)
3002    ->  Bitmap Index Scan on t1_i1
3003          Index Cond: (c1 < 1000)
3004 (4 rows)
3005
3006 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3007 LOG:  pg_hint_plan:
3008 used hint:
3009 BitmapScan(t1)
3010 not used hint:
3011 duplication hint:
3012 error hint:
3013
3014             QUERY PLAN            
3015 ----------------------------------
3016  Bitmap Heap Scan on t1
3017    Recheck Cond: (c1 < $1)
3018    ->  Bitmap Index Scan on t1_i1
3019          Index Cond: (c1 < $1)
3020 (4 rows)
3021
3022 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
3023 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3024 LOG:  pg_hint_plan:
3025 used hint:
3026 BitmapScan(t1)
3027 not used hint:
3028 duplication hint:
3029 error hint:
3030
3031             QUERY PLAN            
3032 ----------------------------------
3033  Bitmap Heap Scan on t1
3034    Recheck Cond: (c1 < $1)
3035    ->  Bitmap Index Scan on t1_i1
3036          Index Cond: (c1 < $1)
3037 (4 rows)
3038
3039 DEALLOCATE p1;
3040 -- No. A-10-1-13
3041 -- No. A-10-1-14
3042 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 = 1;
3043 /*+BitmapScan(t1)*/
3044 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
3045           QUERY PLAN          
3046 ------------------------------
3047  Index Scan using t1_i1 on t1
3048    Index Cond: (c1 = 1)
3049 (2 rows)
3050
3051 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
3052 /*+BitmapScan(t1)*/
3053 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1;
3054           QUERY PLAN          
3055 ------------------------------
3056  Index Scan using t1_i1 on t1
3057    Index Cond: (c1 = 1)
3058 (2 rows)
3059
3060 DEALLOCATE p1;
3061 PREPARE p1 AS SELECT * FROM s1.t1 WHERE t1.c1 < $1;
3062 /*+BitmapScan(t1)*/
3063 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3064       QUERY PLAN       
3065 -----------------------
3066  Seq Scan on t1
3067    Filter: (c1 < 1000)
3068 (2 rows)
3069
3070 /*+BitmapScan(t1)*/
3071 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3072       QUERY PLAN       
3073 -----------------------
3074  Seq Scan on t1
3075    Filter: (c1 < 1000)
3076 (2 rows)
3077
3078 /*+BitmapScan(t1)*/
3079 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3080       QUERY PLAN       
3081 -----------------------
3082  Seq Scan on t1
3083    Filter: (c1 < 1000)
3084 (2 rows)
3085
3086 /*+BitmapScan(t1)*/
3087 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3088       QUERY PLAN       
3089 -----------------------
3090  Seq Scan on t1
3091    Filter: (c1 < 1000)
3092 (2 rows)
3093
3094 /*+BitmapScan(t1)*/
3095 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3096       QUERY PLAN       
3097 -----------------------
3098  Seq Scan on t1
3099    Filter: (c1 < 1000)
3100 (2 rows)
3101
3102 /*+BitmapScan(t1)*/
3103 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3104      QUERY PLAN      
3105 ---------------------
3106  Seq Scan on t1
3107    Filter: (c1 < $1)
3108 (2 rows)
3109
3110 UPDATE pg_catalog.pg_class SET relpages = relpages WHERE relname = 't1';
3111 /*+BitmapScan(t1)*/
3112 EXPLAIN (COSTS false) CREATE TABLE test AS EXECUTE p1 (1000);
3113      QUERY PLAN      
3114 ---------------------
3115  Seq Scan on t1
3116    Filter: (c1 < $1)
3117 (2 rows)
3118
3119 DEALLOCATE p1;
3120 ----
3121 ---- No. A-10-4 EXECUTE statement name error
3122 ----
3123 -- No. A-10-4-1
3124 EXECUTE p1;
3125 ERROR:  prepared statement "p1" does not exist
3126 SHOW pg_hint_plan.debug_print;
3127  pg_hint_plan.debug_print 
3128 --------------------------
3129  on
3130 (1 row)
3131
3132 ----
3133 ---- No. A-11-5 EXECUTE statement name error
3134 ----
3135 -- No. A-11-5-1
3136 SELECT pg_stat_statements_reset();
3137  pg_stat_statements_reset 
3138 --------------------------
3139  
3140 (1 row)
3141
3142 SELECT * FROM s1.t1 WHERE t1.c1 = 1;
3143  c1 | c2 | c3 | c4 
3144 ----+----+----+----
3145   1 |  1 |  1 | 1
3146 (1 row)
3147
3148 /*+Set(enable_seqscan off)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
3149 LOG:  pg_hint_plan:
3150 used hint:
3151 Set(enable_seqscan off)
3152 not used hint:
3153 duplication hint:
3154 error hint:
3155
3156  c1 | c2 | c3 | c4 
3157 ----+----+----+----
3158   1 |  1 |  1 | 1
3159 (1 row)
3160
3161 /*+SeqScan(t1)*/ SELECT * FROM s1.t1 WHERE t1.c1 = 1;
3162 LOG:  pg_hint_plan:
3163 used hint:
3164 SeqScan(t1)
3165 not used hint:
3166 duplication hint:
3167 error hint:
3168
3169  c1 | c2 | c3 | c4 
3170 ----+----+----+----
3171   1 |  1 |  1 | 1
3172 (1 row)
3173
3174 SELECT s.query, s.calls
3175   FROM public.pg_stat_statements s
3176   JOIN pg_catalog.pg_database d
3177     ON (s.dbid = d.oid)
3178  ORDER BY 1;
3179                 query                 | calls 
3180 --------------------------------------+-------
3181  SELECT * FROM s1.t1 WHERE t1.c1 = $1 |     3
3182  SELECT pg_stat_statements_reset()    |     1
3183 (2 rows)
3184
3185 ----
3186 ---- No. A-12-1 reset of global variable of core at the error
3187 ---- No. A-12-2 reset of global variable of original at the error
3188 ----
3189 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3190              QUERY PLAN             
3191 ------------------------------------
3192  Merge Join
3193    Merge Cond: (t1.c1 = t2.c1)
3194    ->  Index Scan using t1_i1 on t1
3195    ->  Sort
3196          Sort Key: t2.c1
3197          ->  Seq Scan on t2
3198 (6 rows)
3199
3200 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
3201 PREPARE p1 AS SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3202 EXPLAIN (COSTS false) EXECUTE p1;
3203 INFO:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
3204 DETAIL:  Relation name "t1" is duplicated.
3205 LOG:  pg_hint_plan:
3206 used hint:
3207 SeqScan(t1)
3208 MergeJoin(t1 t2)
3209 Set(enable_seqscan off)
3210 Set(geqo_threshold 100)
3211 not used hint:
3212 duplication hint:
3213 error hint:
3214 NestLoop(t1 t1)
3215
3216              QUERY PLAN             
3217 ------------------------------------
3218  Merge Join
3219    Merge Cond: (t1.c1 = t2.c1)
3220    ->  Sort
3221          Sort Key: t1.c1
3222          ->  Seq Scan on t1
3223    ->  Index Scan using t2_i1 on t2
3224 (6 rows)
3225
3226 -- No. A-12-1-1
3227 -- No. A-12-2-1
3228 SELECT name, setting FROM settings;
3229              name             |  setting  
3230 ------------------------------+-----------
3231  client_min_messages          | log
3232  geqo                         | on
3233  geqo_effort                  | 5
3234  geqo_generations             | 0
3235  geqo_pool_size               | 0
3236  geqo_seed                    | 0
3237  geqo_selection_bias          | 2
3238  geqo_threshold               | 12
3239  constraint_exclusion         | partition
3240  cursor_tuple_fraction        | 0.1
3241  default_statistics_target    | 100
3242  force_parallel_mode          | off
3243  from_collapse_limit          | 8
3244  join_collapse_limit          | 8
3245  cpu_index_tuple_cost         | 0.005
3246  cpu_operator_cost            | 0.0025
3247  cpu_tuple_cost               | 0.01
3248  effective_cache_size         | 16384
3249  min_parallel_index_scan_size | 64
3250  min_parallel_table_scan_size | 1024
3251  parallel_setup_cost          | 1000
3252  parallel_tuple_cost          | 0.1
3253  random_page_cost             | 4
3254  seq_page_cost                | 1
3255  enable_bitmapscan            | on
3256  enable_gathermerge           | on
3257  enable_hashagg               | on
3258  enable_hashjoin              | on
3259  enable_indexonlyscan         | on
3260  enable_indexscan             | on
3261  enable_material              | on
3262  enable_mergejoin             | on
3263  enable_nestloop              | on
3264  enable_seqscan               | on
3265  enable_sort                  | on
3266  enable_tidscan               | on
3267 (36 rows)
3268
3269 SET pg_hint_plan.parse_messages TO error;
3270 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
3271 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3272 ERROR:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
3273 DETAIL:  Relation name "t1" is duplicated.
3274 SELECT name, setting FROM settings;
3275              name             |  setting  
3276 ------------------------------+-----------
3277  client_min_messages          | log
3278  geqo                         | on
3279  geqo_effort                  | 5
3280  geqo_generations             | 0
3281  geqo_pool_size               | 0
3282  geqo_seed                    | 0
3283  geqo_selection_bias          | 2
3284  geqo_threshold               | 12
3285  constraint_exclusion         | partition
3286  cursor_tuple_fraction        | 0.1
3287  default_statistics_target    | 100
3288  force_parallel_mode          | off
3289  from_collapse_limit          | 8
3290  join_collapse_limit          | 8
3291  cpu_index_tuple_cost         | 0.005
3292  cpu_operator_cost            | 0.0025
3293  cpu_tuple_cost               | 0.01
3294  effective_cache_size         | 16384
3295  min_parallel_index_scan_size | 64
3296  min_parallel_table_scan_size | 1024
3297  parallel_setup_cost          | 1000
3298  parallel_tuple_cost          | 0.1
3299  random_page_cost             | 4
3300  seq_page_cost                | 1
3301  enable_bitmapscan            | on
3302  enable_gathermerge           | on
3303  enable_hashagg               | on
3304  enable_hashjoin              | on
3305  enable_indexonlyscan         | on
3306  enable_indexscan             | on
3307  enable_material              | on
3308  enable_mergejoin             | on
3309  enable_nestloop              | on
3310  enable_seqscan               | on
3311  enable_sort                  | on
3312  enable_tidscan               | on
3313 (36 rows)
3314
3315 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
3316 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3317 LOG:  pg_hint_plan:
3318 used hint:
3319 SeqScan(t1)
3320 MergeJoin(t1 t2)
3321 Set(enable_seqscan off)
3322 Set(geqo_threshold 100)
3323 not used hint:
3324 duplication hint:
3325 error hint:
3326
3327              QUERY PLAN             
3328 ------------------------------------
3329  Merge Join
3330    Merge Cond: (t1.c1 = t2.c1)
3331    ->  Sort
3332          Sort Key: t1.c1
3333          ->  Seq Scan on t1
3334    ->  Index Scan using t2_i1 on t2
3335 (6 rows)
3336
3337 -- No. A-12-1-2
3338 -- No. A-12-2-2
3339 SELECT name, setting FROM settings;
3340              name             |  setting  
3341 ------------------------------+-----------
3342  client_min_messages          | log
3343  geqo                         | on
3344  geqo_effort                  | 5
3345  geqo_generations             | 0
3346  geqo_pool_size               | 0
3347  geqo_seed                    | 0
3348  geqo_selection_bias          | 2
3349  geqo_threshold               | 12
3350  constraint_exclusion         | partition
3351  cursor_tuple_fraction        | 0.1
3352  default_statistics_target    | 100
3353  force_parallel_mode          | off
3354  from_collapse_limit          | 8
3355  join_collapse_limit          | 8
3356  cpu_index_tuple_cost         | 0.005
3357  cpu_operator_cost            | 0.0025
3358  cpu_tuple_cost               | 0.01
3359  effective_cache_size         | 16384
3360  min_parallel_index_scan_size | 64
3361  min_parallel_table_scan_size | 1024
3362  parallel_setup_cost          | 1000
3363  parallel_tuple_cost          | 0.1
3364  random_page_cost             | 4
3365  seq_page_cost                | 1
3366  enable_bitmapscan            | on
3367  enable_gathermerge           | on
3368  enable_hashagg               | on
3369  enable_hashjoin              | on
3370  enable_indexonlyscan         | on
3371  enable_indexscan             | on
3372  enable_material              | on
3373  enable_mergejoin             | on
3374  enable_nestloop              | on
3375  enable_seqscan               | on
3376  enable_sort                  | on
3377  enable_tidscan               | on
3378 (36 rows)
3379
3380 SET pg_hint_plan.parse_messages TO error;
3381 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)NestLoop(t1 t1)*/
3382 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3383 ERROR:  pg_hint_plan: hint syntax error at or near "NestLoop(t1 t1)"
3384 DETAIL:  Relation name "t1" is duplicated.
3385 SELECT name, setting FROM settings;
3386              name             |  setting  
3387 ------------------------------+-----------
3388  client_min_messages          | log
3389  geqo                         | on
3390  geqo_effort                  | 5
3391  geqo_generations             | 0
3392  geqo_pool_size               | 0
3393  geqo_seed                    | 0
3394  geqo_selection_bias          | 2
3395  geqo_threshold               | 12
3396  constraint_exclusion         | partition
3397  cursor_tuple_fraction        | 0.1
3398  default_statistics_target    | 100
3399  force_parallel_mode          | off
3400  from_collapse_limit          | 8
3401  join_collapse_limit          | 8
3402  cpu_index_tuple_cost         | 0.005
3403  cpu_operator_cost            | 0.0025
3404  cpu_tuple_cost               | 0.01
3405  effective_cache_size         | 16384
3406  min_parallel_index_scan_size | 64
3407  min_parallel_table_scan_size | 1024
3408  parallel_setup_cost          | 1000
3409  parallel_tuple_cost          | 0.1
3410  random_page_cost             | 4
3411  seq_page_cost                | 1
3412  enable_bitmapscan            | on
3413  enable_gathermerge           | on
3414  enable_hashagg               | on
3415  enable_hashjoin              | on
3416  enable_indexonlyscan         | on
3417  enable_indexscan             | on
3418  enable_material              | on
3419  enable_mergejoin             | on
3420  enable_nestloop              | on
3421  enable_seqscan               | on
3422  enable_sort                  | on
3423  enable_tidscan               | on
3424 (36 rows)
3425
3426 EXPLAIN (COSTS false) EXECUTE p1;
3427              QUERY PLAN             
3428 ------------------------------------
3429  Merge Join
3430    Merge Cond: (t1.c1 = t2.c1)
3431    ->  Sort
3432          Sort Key: t1.c1
3433          ->  Seq Scan on t1
3434    ->  Index Scan using t2_i1 on t2
3435 (6 rows)
3436
3437 -- No. A-12-1-3
3438 -- No. A-12-2-3
3439 SELECT name, setting FROM settings;
3440              name             |  setting  
3441 ------------------------------+-----------
3442  client_min_messages          | log
3443  geqo                         | on
3444  geqo_effort                  | 5
3445  geqo_generations             | 0
3446  geqo_pool_size               | 0
3447  geqo_seed                    | 0
3448  geqo_selection_bias          | 2
3449  geqo_threshold               | 12
3450  constraint_exclusion         | partition
3451  cursor_tuple_fraction        | 0.1
3452  default_statistics_target    | 100
3453  force_parallel_mode          | off
3454  from_collapse_limit          | 8
3455  join_collapse_limit          | 8
3456  cpu_index_tuple_cost         | 0.005
3457  cpu_operator_cost            | 0.0025
3458  cpu_tuple_cost               | 0.01
3459  effective_cache_size         | 16384
3460  min_parallel_index_scan_size | 64
3461  min_parallel_table_scan_size | 1024
3462  parallel_setup_cost          | 1000
3463  parallel_tuple_cost          | 0.1
3464  random_page_cost             | 4
3465  seq_page_cost                | 1
3466  enable_bitmapscan            | on
3467  enable_gathermerge           | on
3468  enable_hashagg               | on
3469  enable_hashjoin              | on
3470  enable_indexonlyscan         | on
3471  enable_indexscan             | on
3472  enable_material              | on
3473  enable_mergejoin             | on
3474  enable_nestloop              | on
3475  enable_seqscan               | on
3476  enable_sort                  | on
3477  enable_tidscan               | on
3478 (36 rows)
3479
3480 SET pg_hint_plan.parse_messages TO error;
3481 EXPLAIN (COSTS false) EXECUTE p2;
3482 ERROR:  prepared statement "p2" does not exist
3483 /*+Set(enable_seqscan off)Set(geqo_threshold 100)SeqScan(t1)MergeJoin(t1 t2)*/
3484 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3485 LOG:  pg_hint_plan:
3486 used hint:
3487 SeqScan(t1)
3488 MergeJoin(t1 t2)
3489 Set(enable_seqscan off)
3490 Set(geqo_threshold 100)
3491 not used hint:
3492 duplication hint:
3493 error hint:
3494
3495              QUERY PLAN             
3496 ------------------------------------
3497  Merge Join
3498    Merge Cond: (t1.c1 = t2.c1)
3499    ->  Sort
3500          Sort Key: t1.c1
3501          ->  Seq Scan on t1
3502    ->  Index Scan using t2_i1 on t2
3503 (6 rows)
3504
3505 EXPLAIN (COSTS false) EXECUTE p1;
3506              QUERY PLAN             
3507 ------------------------------------
3508  Merge Join
3509    Merge Cond: (t1.c1 = t2.c1)
3510    ->  Sort
3511          Sort Key: t1.c1
3512          ->  Seq Scan on t1
3513    ->  Index Scan using t2_i1 on t2
3514 (6 rows)
3515
3516 SELECT name, setting FROM settings;
3517              name             |  setting  
3518 ------------------------------+-----------
3519  client_min_messages          | log
3520  geqo                         | on
3521  geqo_effort                  | 5
3522  geqo_generations             | 0
3523  geqo_pool_size               | 0
3524  geqo_seed                    | 0
3525  geqo_selection_bias          | 2
3526  geqo_threshold               | 12
3527  constraint_exclusion         | partition
3528  cursor_tuple_fraction        | 0.1
3529  default_statistics_target    | 100
3530  force_parallel_mode          | off
3531  from_collapse_limit          | 8
3532  join_collapse_limit          | 8
3533  cpu_index_tuple_cost         | 0.005
3534  cpu_operator_cost            | 0.0025
3535  cpu_tuple_cost               | 0.01
3536  effective_cache_size         | 16384
3537  min_parallel_index_scan_size | 64
3538  min_parallel_table_scan_size | 1024
3539  parallel_setup_cost          | 1000
3540  parallel_tuple_cost          | 0.1
3541  random_page_cost             | 4
3542  seq_page_cost                | 1
3543  enable_bitmapscan            | on
3544  enable_gathermerge           | on
3545  enable_hashagg               | on
3546  enable_hashjoin              | on
3547  enable_indexonlyscan         | on
3548  enable_indexscan             | on
3549  enable_material              | on
3550  enable_mergejoin             | on
3551  enable_nestloop              | on
3552  enable_seqscan               | on
3553  enable_sort                  | on
3554  enable_tidscan               | on
3555 (36 rows)
3556
3557 -- No. A-12-1-4
3558 -- No. A-12-2-4
3559 SELECT name, setting FROM settings;
3560              name             |  setting  
3561 ------------------------------+-----------
3562  client_min_messages          | log
3563  geqo                         | on
3564  geqo_effort                  | 5
3565  geqo_generations             | 0
3566  geqo_pool_size               | 0
3567  geqo_seed                    | 0
3568  geqo_selection_bias          | 2
3569  geqo_threshold               | 12
3570  constraint_exclusion         | partition
3571  cursor_tuple_fraction        | 0.1
3572  default_statistics_target    | 100
3573  force_parallel_mode          | off
3574  from_collapse_limit          | 8
3575  join_collapse_limit          | 8
3576  cpu_index_tuple_cost         | 0.005
3577  cpu_operator_cost            | 0.0025
3578  cpu_tuple_cost               | 0.01
3579  effective_cache_size         | 16384
3580  min_parallel_index_scan_size | 64
3581  min_parallel_table_scan_size | 1024
3582  parallel_setup_cost          | 1000
3583  parallel_tuple_cost          | 0.1
3584  random_page_cost             | 4
3585  seq_page_cost                | 1
3586  enable_bitmapscan            | on
3587  enable_gathermerge           | on
3588  enable_hashagg               | on
3589  enable_hashjoin              | on
3590  enable_indexonlyscan         | on
3591  enable_indexscan             | on
3592  enable_material              | on
3593  enable_mergejoin             | on
3594  enable_nestloop              | on
3595  enable_seqscan               | on
3596  enable_sort                  | on
3597  enable_tidscan               | on
3598 (36 rows)
3599
3600 SET pg_hint_plan.parse_messages TO error;
3601 EXPLAIN (COSTS false) EXECUTE p2;
3602 ERROR:  prepared statement "p2" does not exist
3603 EXPLAIN (COSTS false) EXECUTE p1;
3604              QUERY PLAN             
3605 ------------------------------------
3606  Merge Join
3607    Merge Cond: (t1.c1 = t2.c1)
3608    ->  Sort
3609          Sort Key: t1.c1
3610          ->  Seq Scan on t1
3611    ->  Index Scan using t2_i1 on t2
3612 (6 rows)
3613
3614 SELECT name, setting FROM settings;
3615              name             |  setting  
3616 ------------------------------+-----------
3617  client_min_messages          | log
3618  geqo                         | on
3619  geqo_effort                  | 5
3620  geqo_generations             | 0
3621  geqo_pool_size               | 0
3622  geqo_seed                    | 0
3623  geqo_selection_bias          | 2
3624  geqo_threshold               | 12
3625  constraint_exclusion         | partition
3626  cursor_tuple_fraction        | 0.1
3627  default_statistics_target    | 100
3628  force_parallel_mode          | off
3629  from_collapse_limit          | 8
3630  join_collapse_limit          | 8
3631  cpu_index_tuple_cost         | 0.005
3632  cpu_operator_cost            | 0.0025
3633  cpu_tuple_cost               | 0.01
3634  effective_cache_size         | 16384
3635  min_parallel_index_scan_size | 64
3636  min_parallel_table_scan_size | 1024
3637  parallel_setup_cost          | 1000
3638  parallel_tuple_cost          | 0.1
3639  random_page_cost             | 4
3640  seq_page_cost                | 1
3641  enable_bitmapscan            | on
3642  enable_gathermerge           | on
3643  enable_hashagg               | on
3644  enable_hashjoin              | on
3645  enable_indexonlyscan         | on
3646  enable_indexscan             | on
3647  enable_material              | on
3648  enable_mergejoin             | on
3649  enable_nestloop              | on
3650  enable_seqscan               | on
3651  enable_sort                  | on
3652  enable_tidscan               | on
3653 (36 rows)
3654
3655 DEALLOCATE p1;
3656 SET pg_hint_plan.parse_messages TO LOG;
3657 ----
3658 ---- No. A-12-3 effective range of the hint
3659 ----
3660 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3661              QUERY PLAN             
3662 ------------------------------------
3663  Merge Join
3664    Merge Cond: (t1.c1 = t2.c1)
3665    ->  Index Scan using t1_i1 on t1
3666    ->  Sort
3667          Sort Key: t2.c1
3668          ->  Seq Scan on t2
3669 (6 rows)
3670
3671 -- No. A-12-3-1
3672 SET enable_indexscan TO off;
3673 SET enable_mergejoin TO off;
3674 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3675           QUERY PLAN          
3676 ------------------------------
3677  Hash Join
3678    Hash Cond: (t1.c1 = t2.c1)
3679    ->  Seq Scan on t1
3680    ->  Hash
3681          ->  Seq Scan on t2
3682 (5 rows)
3683
3684 SELECT name, setting FROM settings;
3685              name             |  setting  
3686 ------------------------------+-----------
3687  client_min_messages          | log
3688  geqo                         | on
3689  geqo_effort                  | 5
3690  geqo_generations             | 0
3691  geqo_pool_size               | 0
3692  geqo_seed                    | 0
3693  geqo_selection_bias          | 2
3694  geqo_threshold               | 12
3695  constraint_exclusion         | partition
3696  cursor_tuple_fraction        | 0.1
3697  default_statistics_target    | 100
3698  force_parallel_mode          | off
3699  from_collapse_limit          | 8
3700  join_collapse_limit          | 8
3701  cpu_index_tuple_cost         | 0.005
3702  cpu_operator_cost            | 0.0025
3703  cpu_tuple_cost               | 0.01
3704  effective_cache_size         | 16384
3705  min_parallel_index_scan_size | 64
3706  min_parallel_table_scan_size | 1024
3707  parallel_setup_cost          | 1000
3708  parallel_tuple_cost          | 0.1
3709  random_page_cost             | 4
3710  seq_page_cost                | 1
3711  enable_bitmapscan            | on
3712  enable_gathermerge           | on
3713  enable_hashagg               | on
3714  enable_hashjoin              | on
3715  enable_indexonlyscan         | on
3716  enable_indexscan             | off
3717  enable_material              | on
3718  enable_mergejoin             | off
3719  enable_nestloop              | on
3720  enable_seqscan               | on
3721  enable_sort                  | on
3722  enable_tidscan               | on
3723 (36 rows)
3724
3725 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
3726 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3727 LOG:  pg_hint_plan:
3728 used hint:
3729 IndexScan(t2)
3730 MergeJoin(t1 t2)
3731 Leading(t2 t1)
3732 Set(enable_indexscan on)
3733 Set(geqo_threshold 100)
3734 not used hint:
3735 duplication hint:
3736 error hint:
3737
3738              QUERY PLAN             
3739 ------------------------------------
3740  Merge Join
3741    Merge Cond: (t1.c1 = t2.c1)
3742    ->  Index Scan using t1_i1 on t1
3743    ->  Index Scan using t2_i1 on t2
3744 (4 rows)
3745
3746 SELECT name, setting FROM settings;
3747              name             |  setting  
3748 ------------------------------+-----------
3749  client_min_messages          | log
3750  geqo                         | on
3751  geqo_effort                  | 5
3752  geqo_generations             | 0
3753  geqo_pool_size               | 0
3754  geqo_seed                    | 0
3755  geqo_selection_bias          | 2
3756  geqo_threshold               | 12
3757  constraint_exclusion         | partition
3758  cursor_tuple_fraction        | 0.1
3759  default_statistics_target    | 100
3760  force_parallel_mode          | off
3761  from_collapse_limit          | 8
3762  join_collapse_limit          | 8
3763  cpu_index_tuple_cost         | 0.005
3764  cpu_operator_cost            | 0.0025
3765  cpu_tuple_cost               | 0.01
3766  effective_cache_size         | 16384
3767  min_parallel_index_scan_size | 64
3768  min_parallel_table_scan_size | 1024
3769  parallel_setup_cost          | 1000
3770  parallel_tuple_cost          | 0.1
3771  random_page_cost             | 4
3772  seq_page_cost                | 1
3773  enable_bitmapscan            | on
3774  enable_gathermerge           | on
3775  enable_hashagg               | on
3776  enable_hashjoin              | on
3777  enable_indexonlyscan         | on
3778  enable_indexscan             | off
3779  enable_material              | on
3780  enable_mergejoin             | off
3781  enable_nestloop              | on
3782  enable_seqscan               | on
3783  enable_sort                  | on
3784  enable_tidscan               | on
3785 (36 rows)
3786
3787 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3788           QUERY PLAN          
3789 ------------------------------
3790  Hash Join
3791    Hash Cond: (t1.c1 = t2.c1)
3792    ->  Seq Scan on t1
3793    ->  Hash
3794          ->  Seq Scan on t2
3795 (5 rows)
3796
3797 -- No. A-12-3-2
3798 SET enable_indexscan TO off;
3799 SET enable_mergejoin TO off;
3800 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3801           QUERY PLAN          
3802 ------------------------------
3803  Hash Join
3804    Hash Cond: (t1.c1 = t2.c1)
3805    ->  Seq Scan on t1
3806    ->  Hash
3807          ->  Seq Scan on t2
3808 (5 rows)
3809
3810 SELECT name, setting FROM settings;
3811              name             |  setting  
3812 ------------------------------+-----------
3813  client_min_messages          | log
3814  geqo                         | on
3815  geqo_effort                  | 5
3816  geqo_generations             | 0
3817  geqo_pool_size               | 0
3818  geqo_seed                    | 0
3819  geqo_selection_bias          | 2
3820  geqo_threshold               | 12
3821  constraint_exclusion         | partition
3822  cursor_tuple_fraction        | 0.1
3823  default_statistics_target    | 100
3824  force_parallel_mode          | off
3825  from_collapse_limit          | 8
3826  join_collapse_limit          | 8
3827  cpu_index_tuple_cost         | 0.005
3828  cpu_operator_cost            | 0.0025
3829  cpu_tuple_cost               | 0.01
3830  effective_cache_size         | 16384
3831  min_parallel_index_scan_size | 64
3832  min_parallel_table_scan_size | 1024
3833  parallel_setup_cost          | 1000
3834  parallel_tuple_cost          | 0.1
3835  random_page_cost             | 4
3836  seq_page_cost                | 1
3837  enable_bitmapscan            | on
3838  enable_gathermerge           | on
3839  enable_hashagg               | on
3840  enable_hashjoin              | on
3841  enable_indexonlyscan         | on
3842  enable_indexscan             | off
3843  enable_material              | on
3844  enable_mergejoin             | off
3845  enable_nestloop              | on
3846  enable_seqscan               | on
3847  enable_sort                  | on
3848  enable_tidscan               | on
3849 (36 rows)
3850
3851 BEGIN;
3852 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
3853 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3854 LOG:  pg_hint_plan:
3855 used hint:
3856 IndexScan(t2)
3857 MergeJoin(t1 t2)
3858 Leading(t2 t1)
3859 Set(enable_indexscan on)
3860 Set(geqo_threshold 100)
3861 not used hint:
3862 duplication hint:
3863 error hint:
3864
3865              QUERY PLAN             
3866 ------------------------------------
3867  Merge Join
3868    Merge Cond: (t1.c1 = t2.c1)
3869    ->  Index Scan using t1_i1 on t1
3870    ->  Index Scan using t2_i1 on t2
3871 (4 rows)
3872
3873 COMMIT;
3874 BEGIN;
3875 SELECT name, setting FROM settings;
3876              name             |  setting  
3877 ------------------------------+-----------
3878  client_min_messages          | log
3879  geqo                         | on
3880  geqo_effort                  | 5
3881  geqo_generations             | 0
3882  geqo_pool_size               | 0
3883  geqo_seed                    | 0
3884  geqo_selection_bias          | 2
3885  geqo_threshold               | 12
3886  constraint_exclusion         | partition
3887  cursor_tuple_fraction        | 0.1
3888  default_statistics_target    | 100
3889  force_parallel_mode          | off
3890  from_collapse_limit          | 8
3891  join_collapse_limit          | 8
3892  cpu_index_tuple_cost         | 0.005
3893  cpu_operator_cost            | 0.0025
3894  cpu_tuple_cost               | 0.01
3895  effective_cache_size         | 16384
3896  min_parallel_index_scan_size | 64
3897  min_parallel_table_scan_size | 1024
3898  parallel_setup_cost          | 1000
3899  parallel_tuple_cost          | 0.1
3900  random_page_cost             | 4
3901  seq_page_cost                | 1
3902  enable_bitmapscan            | on
3903  enable_gathermerge           | on
3904  enable_hashagg               | on
3905  enable_hashjoin              | on
3906  enable_indexonlyscan         | on
3907  enable_indexscan             | off
3908  enable_material              | on
3909  enable_mergejoin             | off
3910  enable_nestloop              | on
3911  enable_seqscan               | on
3912  enable_sort                  | on
3913  enable_tidscan               | on
3914 (36 rows)
3915
3916 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3917           QUERY PLAN          
3918 ------------------------------
3919  Hash Join
3920    Hash Cond: (t1.c1 = t2.c1)
3921    ->  Seq Scan on t1
3922    ->  Hash
3923          ->  Seq Scan on t2
3924 (5 rows)
3925
3926 COMMIT;
3927 -- No. A-12-3-3
3928 SET enable_indexscan TO off;
3929 SET enable_mergejoin TO off;
3930 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3931           QUERY PLAN          
3932 ------------------------------
3933  Hash Join
3934    Hash Cond: (t1.c1 = t2.c1)
3935    ->  Seq Scan on t1
3936    ->  Hash
3937          ->  Seq Scan on t2
3938 (5 rows)
3939
3940 SELECT name, setting FROM settings;
3941              name             |  setting  
3942 ------------------------------+-----------
3943  client_min_messages          | log
3944  geqo                         | on
3945  geqo_effort                  | 5
3946  geqo_generations             | 0
3947  geqo_pool_size               | 0
3948  geqo_seed                    | 0
3949  geqo_selection_bias          | 2
3950  geqo_threshold               | 12
3951  constraint_exclusion         | partition
3952  cursor_tuple_fraction        | 0.1
3953  default_statistics_target    | 100
3954  force_parallel_mode          | off
3955  from_collapse_limit          | 8
3956  join_collapse_limit          | 8
3957  cpu_index_tuple_cost         | 0.005
3958  cpu_operator_cost            | 0.0025
3959  cpu_tuple_cost               | 0.01
3960  effective_cache_size         | 16384
3961  min_parallel_index_scan_size | 64
3962  min_parallel_table_scan_size | 1024
3963  parallel_setup_cost          | 1000
3964  parallel_tuple_cost          | 0.1
3965  random_page_cost             | 4
3966  seq_page_cost                | 1
3967  enable_bitmapscan            | on
3968  enable_gathermerge           | on
3969  enable_hashagg               | on
3970  enable_hashjoin              | on
3971  enable_indexonlyscan         | on
3972  enable_indexscan             | off
3973  enable_material              | on
3974  enable_mergejoin             | off
3975  enable_nestloop              | on
3976  enable_seqscan               | on
3977  enable_sort                  | on
3978  enable_tidscan               | on
3979 (36 rows)
3980
3981 /*+Set(enable_indexscan on)Set(geqo_threshold 100)IndexScan(t2)MergeJoin(t1 t2)Leading(t2 t1)*/
3982 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
3983 LOG:  pg_hint_plan:
3984 used hint:
3985 IndexScan(t2)
3986 MergeJoin(t1 t2)
3987 Leading(t2 t1)
3988 Set(enable_indexscan on)
3989 Set(geqo_threshold 100)
3990 not used hint:
3991 duplication hint:
3992 error hint:
3993
3994              QUERY PLAN             
3995 ------------------------------------
3996  Merge Join
3997    Merge Cond: (t1.c1 = t2.c1)
3998    ->  Index Scan using t1_i1 on t1
3999    ->  Index Scan using t2_i1 on t2
4000 (4 rows)
4001
4002 \connect
4003 SET enable_indexscan TO off;
4004 SET enable_mergejoin TO off;
4005 LOAD 'pg_hint_plan';
4006 SELECT name, setting FROM settings;
4007              name             |  setting  
4008 ------------------------------+-----------
4009  client_min_messages          | notice
4010  geqo                         | on
4011  geqo_effort                  | 5
4012  geqo_generations             | 0
4013  geqo_pool_size               | 0
4014  geqo_seed                    | 0
4015  geqo_selection_bias          | 2
4016  geqo_threshold               | 12
4017  constraint_exclusion         | partition
4018  cursor_tuple_fraction        | 0.1
4019  default_statistics_target    | 100
4020  force_parallel_mode          | off
4021  from_collapse_limit          | 8
4022  join_collapse_limit          | 8
4023  cpu_index_tuple_cost         | 0.005
4024  cpu_operator_cost            | 0.0025
4025  cpu_tuple_cost               | 0.01
4026  effective_cache_size         | 16384
4027  min_parallel_index_scan_size | 64
4028  min_parallel_table_scan_size | 1024
4029  parallel_setup_cost          | 1000
4030  parallel_tuple_cost          | 0.1
4031  random_page_cost             | 4
4032  seq_page_cost                | 1
4033  enable_bitmapscan            | on
4034  enable_gathermerge           | on
4035  enable_hashagg               | on
4036  enable_hashjoin              | on
4037  enable_indexonlyscan         | on
4038  enable_indexscan             | off
4039  enable_material              | on
4040  enable_mergejoin             | off
4041  enable_nestloop              | on
4042  enable_seqscan               | on
4043  enable_sort                  | on
4044  enable_tidscan               | on
4045 (36 rows)
4046
4047 EXPLAIN (COSTS false) SELECT * FROM s1.t1, s1.t2 WHERE t1.c1 = t2.c1;
4048           QUERY PLAN          
4049 ------------------------------
4050  Hash Join
4051    Hash Cond: (t1.c1 = t2.c1)
4052    ->  Seq Scan on t1
4053    ->  Hash
4054          ->  Seq Scan on t2
4055 (5 rows)
4056
4057 SET pg_hint_plan.enable_hint TO on;
4058 SET pg_hint_plan.debug_print TO on;
4059 SET client_min_messages TO LOG;
4060 SET search_path TO public;
4061 RESET enable_indexscan;
4062 RESET enable_mergejoin;
4063 ----
4064 ---- No. A-13 call planner recursively
4065 ----
4066 CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
4067 DECLARE
4068     new_cnt int;
4069 BEGIN
4070     RAISE NOTICE 'nested_planner(%)', cnt;
4071
4072     /* 再帰終了の判断 */
4073     IF cnt <= 1 THEN
4074         RETURN 0;
4075     END IF;
4076
4077         SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1) INTO new_cnt
4078           FROM s1.t1 t_1
4079           JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4080          ORDER BY t_1.c1 LIMIT 1;
4081
4082     RETURN new_cnt;
4083 END;
4084 $$ LANGUAGE plpgsql IMMUTABLE;
4085 ----
4086 ---- No. A-13-2 use hint of main query
4087 ----
4088 --No.13-2-1
4089 EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
4090 NOTICE:  nested_planner(1)
4091               QUERY PLAN               
4092 ---------------------------------------
4093  Index Only Scan using t1_i1 on t1 t_1
4094 (1 row)
4095
4096 /*+SeqScan(t_1)*/
4097 EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
4098 NOTICE:  nested_planner(1)
4099 LOG:  pg_hint_plan:
4100 used hint:
4101 SeqScan(t_1)
4102 not used hint:
4103 duplication hint:
4104 error hint:
4105
4106         QUERY PLAN        
4107 --------------------------
4108  Sort
4109    Sort Key: c1
4110    ->  Seq Scan on t1 t_1
4111 (3 rows)
4112
4113 ----
4114 ---- No. A-13-3 output number of times of debugging log
4115 ----
4116 --No.13-3-1
4117 EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
4118 NOTICE:  nested_planner(1)
4119               QUERY PLAN               
4120 ---------------------------------------
4121  Index Only Scan using t1_i1 on t1 t_1
4122 (1 row)
4123
4124 /*+SeqScan(t_2)*/
4125 EXPLAIN (COSTS false) SELECT nested_planner(1) FROM s1.t1 t_1 ORDER BY t_1.c1;
4126 NOTICE:  nested_planner(1)
4127 LOG:  pg_hint_plan:
4128 used hint:
4129 not used hint:
4130 SeqScan(t_2)
4131 duplication hint:
4132 error hint:
4133
4134               QUERY PLAN               
4135 ---------------------------------------
4136  Index Only Scan using t1_i1 on t1 t_1
4137 (1 row)
4138
4139 --No.13-3-2
4140 EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
4141 NOTICE:  nested_planner(2)
4142 NOTICE:  nested_planner(1)
4143 LOG:  pg_hint_plan:
4144 used hint:
4145 IndexScan(t_1)
4146 not used hint:
4147 duplication hint:
4148 error hint:
4149
4150               QUERY PLAN               
4151 ---------------------------------------
4152  Index Only Scan using t1_i1 on t1 t_1
4153 (1 row)
4154
4155 /*+SeqScan(t_2)*/
4156 EXPLAIN (COSTS false) SELECT nested_planner(2) FROM s1.t1 t_1 ORDER BY t_1.c1;
4157 NOTICE:  nested_planner(2)
4158 NOTICE:  nested_planner(1)
4159 LOG:  pg_hint_plan:
4160 used hint:
4161 IndexScan(t_1)
4162 not used hint:
4163 duplication hint:
4164 error hint:
4165
4166 LOG:  pg_hint_plan:
4167 used hint:
4168 not used hint:
4169 SeqScan(t_2)
4170 duplication hint:
4171 error hint:
4172
4173               QUERY PLAN               
4174 ---------------------------------------
4175  Index Only Scan using t1_i1 on t1 t_1
4176 (1 row)
4177
4178 --No.13-3-3
4179 --
4180 -- Redefine not to use cached plan
4181 --
4182 CREATE OR REPLACE FUNCTION nested_planner(cnt int) RETURNS int AS $$
4183 DECLARE
4184     new_cnt int;
4185 BEGIN
4186     RAISE NOTICE 'nested_planner(%)', cnt;
4187
4188     /* 再帰終了の判断 */
4189     IF cnt <= 1 THEN
4190         RETURN 0;
4191     END IF;
4192
4193         SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1) INTO new_cnt
4194           FROM s1.t1 t_1
4195           JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4196          ORDER BY t_1.c1 LIMIT 1;
4197
4198     RETURN new_cnt;
4199 END;
4200 $$ LANGUAGE plpgsql IMMUTABLE;
4201 -- The function called at the bottom desn't use a hint, the immediate
4202 -- caller level should restore its own hint. So, the first LOG from
4203 -- pg_hint_plan should use the IndexScan(t_1) hint
4204 EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
4205 NOTICE:  nested_planner(5)
4206 NOTICE:  nested_planner(4)
4207 NOTICE:  nested_planner(3)
4208 NOTICE:  nested_planner(2)
4209 NOTICE:  nested_planner(1)
4210 LOG:  pg_hint_plan:
4211 used hint:
4212 IndexScan(t_1)
4213 not used hint:
4214 duplication hint:
4215 error hint:
4216
4217 LOG:  pg_hint_plan:
4218 used hint:
4219 IndexScan(t_1)
4220 not used hint:
4221 duplication hint:
4222 error hint:
4223
4224 LOG:  pg_hint_plan:
4225 used hint:
4226 IndexScan(t_1)
4227 not used hint:
4228 duplication hint:
4229 error hint:
4230
4231 LOG:  pg_hint_plan:
4232 used hint:
4233 IndexScan(t_1)
4234 not used hint:
4235 duplication hint:
4236 error hint:
4237
4238               QUERY PLAN               
4239 ---------------------------------------
4240  Index Only Scan using t1_i1 on t1 t_1
4241 (1 row)
4242
4243 -- The top level uses SeqScan(t_1), but the function should use only
4244 -- the hint in the function.
4245 /*+SeqScan(t_1) SeqScan(t_2)*/
4246 EXPLAIN (COSTS false) SELECT nested_planner(5) FROM s1.t1 t_1 ORDER BY t_1.c1;
4247 NOTICE:  nested_planner(5)
4248 NOTICE:  nested_planner(4)
4249 NOTICE:  nested_planner(3)
4250 NOTICE:  nested_planner(2)
4251 NOTICE:  nested_planner(1)
4252 LOG:  pg_hint_plan:
4253 used hint:
4254 IndexScan(t_1)
4255 not used hint:
4256 duplication hint:
4257 error hint:
4258
4259 LOG:  pg_hint_plan:
4260 used hint:
4261 IndexScan(t_1)
4262 not used hint:
4263 duplication hint:
4264 error hint:
4265
4266 LOG:  pg_hint_plan:
4267 used hint:
4268 IndexScan(t_1)
4269 not used hint:
4270 duplication hint:
4271 error hint:
4272
4273 LOG:  pg_hint_plan:
4274 used hint:
4275 IndexScan(t_1)
4276 not used hint:
4277 duplication hint:
4278 error hint:
4279
4280 LOG:  pg_hint_plan:
4281 used hint:
4282 SeqScan(t_1)
4283 not used hint:
4284 SeqScan(t_2)
4285 duplication hint:
4286 error hint:
4287
4288         QUERY PLAN        
4289 --------------------------
4290  Sort
4291    Sort Key: c1
4292    ->  Seq Scan on t1 t_1
4293 (3 rows)
4294
4295 ----
4296 ---- No. A-13-4 output of debugging log on hint status
4297 ----
4298 CREATE OR REPLACE FUNCTION recall_planner() RETURNS int AS $$
4299         SELECT /*+ IndexScan(t_1) */t_1.c1
4300           FROM s1.t1 t_1
4301           JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4302          ORDER BY t_1.c1 LIMIT 1;
4303 $$ LANGUAGE SQL IMMUTABLE;
4304 --No.13-4-1
4305 -- recall_planner() is reduced to constant while planning using the
4306 -- hint defined in the function. Then the outer query is planned based
4307 -- on the following hint. pg_hint_plan shows the log for the function
4308 -- but the resulting explain output doesn't contain the corresponding
4309 -- plan.
4310 /*+HashJoin(t_1 t_2)*/
4311 EXPLAIN (COSTS false)
4312  SELECT recall_planner() FROM s1.t1 t_1
4313    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4314   ORDER BY t_1.c1;
4315 LOG:  pg_hint_plan:
4316 used hint:
4317 IndexScan(t_1)
4318 not used hint:
4319 duplication hint:
4320 error hint:
4321
4322 LOG:  pg_hint_plan:
4323 used hint:
4324 HashJoin(t_1 t_2)
4325 not used hint:
4326 duplication hint:
4327 error hint:
4328
4329               QUERY PLAN              
4330 --------------------------------------
4331  Sort
4332    Sort Key: t_1.c1
4333    ->  Hash Join
4334          Hash Cond: (t_1.c1 = t_2.c1)
4335          ->  Seq Scan on t1 t_1
4336          ->  Hash
4337                ->  Seq Scan on t2 t_2
4338 (7 rows)
4339
4340 --No.13-4-2
4341 --See description for No.13-4-1
4342 /*+HashJoin(st_1 st_2)*/
4343 EXPLAIN (COSTS false)
4344  SELECT recall_planner() FROM s1.t1 st_1
4345    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
4346   ORDER BY st_1.c1;
4347 LOG:  pg_hint_plan:
4348 used hint:
4349 IndexScan(t_1)
4350 not used hint:
4351 duplication hint:
4352 error hint:
4353
4354 LOG:  pg_hint_plan:
4355 used hint:
4356 HashJoin(st_1 st_2)
4357 not used hint:
4358 duplication hint:
4359 error hint:
4360
4361                QUERY PLAN               
4362 ----------------------------------------
4363  Sort
4364    Sort Key: st_1.c1
4365    ->  Hash Join
4366          Hash Cond: (st_1.c1 = st_2.c1)
4367          ->  Seq Scan on t1 st_1
4368          ->  Hash
4369                ->  Seq Scan on t2 st_2
4370 (7 rows)
4371
4372 --No.13-4-3
4373 --See description for No.13-4-1
4374 /*+HashJoin(t_1 t_2)*/
4375 EXPLAIN (COSTS false)
4376  SELECT recall_planner() FROM s1.t1 st_1
4377    JOIN s1.t2 st_2 ON (st_1.c1 = st_2.c1)
4378   ORDER BY st_1.c1;
4379 LOG:  pg_hint_plan:
4380 used hint:
4381 IndexScan(t_1)
4382 not used hint:
4383 duplication hint:
4384 error hint:
4385
4386 LOG:  pg_hint_plan:
4387 used hint:
4388 not used hint:
4389 HashJoin(t_1 t_2)
4390 duplication hint:
4391 error hint:
4392
4393                   QUERY PLAN                  
4394 ----------------------------------------------
4395  Merge Join
4396    Merge Cond: (st_1.c1 = st_2.c1)
4397    ->  Index Only Scan using t1_i1 on t1 st_1
4398    ->  Sort
4399          Sort Key: st_2.c1
4400          ->  Seq Scan on t2 st_2
4401 (6 rows)
4402
4403 --No.13-4-4
4404 --See description for No.13-4-1
4405 /*+HashJoin(st_1 st_2)*/
4406 EXPLAIN (COSTS false)
4407  SELECT recall_planner() FROM s1.t1 t_1
4408    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4409   ORDER BY t_1.c1;
4410 LOG:  pg_hint_plan:
4411 used hint:
4412 IndexScan(t_1)
4413 not used hint:
4414 duplication hint:
4415 error hint:
4416
4417 LOG:  pg_hint_plan:
4418 used hint:
4419 not used hint:
4420 HashJoin(st_1 st_2)
4421 duplication hint:
4422 error hint:
4423
4424                  QUERY PLAN                  
4425 ---------------------------------------------
4426  Merge Join
4427    Merge Cond: (t_1.c1 = t_2.c1)
4428    ->  Index Only Scan using t1_i1 on t1 t_1
4429    ->  Sort
4430          Sort Key: t_2.c1
4431          ->  Seq Scan on t2 t_2
4432 (6 rows)
4433
4434 --No.13-4-5
4435 -- See description for No.13-4-1. No joins in ths plan, so
4436 -- pg_hint_plan doesn't complain on the wrongly written error hint.
4437 /*+HashJoin(t_1 t_1)*/
4438 EXPLAIN (COSTS false)
4439  SELECT recall_planner() FROM s1.t1 t_1
4440   ORDER BY t_1.c1;
4441 LOG:  pg_hint_plan:
4442 used hint:
4443 IndexScan(t_1)
4444 not used hint:
4445 duplication hint:
4446 error hint:
4447
4448 LOG:  pg_hint_plan:
4449 used hint:
4450 not used hint:
4451 HashJoin(t_1 t_1)
4452 duplication hint:
4453 error hint:
4454
4455               QUERY PLAN               
4456 ---------------------------------------
4457  Index Only Scan using t1_i1 on t1 t_1
4458 (1 row)
4459
4460 --No.13-4-6
4461 CREATE OR REPLACE FUNCTION recall_planner_one_t() RETURNS int AS $$
4462         SELECT /*+ IndexScan(t_1) */t_1.c1
4463           FROM s1.t1 t_1
4464          ORDER BY t_1.c1 LIMIT 1;
4465 $$ LANGUAGE SQL IMMUTABLE;
4466 EXPLAIN (COSTS false)
4467  SELECT recall_planner_one_t() FROM s1.t1 t_1
4468    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4469   ORDER BY t_1.c1;
4470 LOG:  pg_hint_plan:
4471 used hint:
4472 IndexScan(t_1)
4473 not used hint:
4474 duplication hint:
4475 error hint:
4476
4477                  QUERY PLAN                  
4478 ---------------------------------------------
4479  Merge Join
4480    Merge Cond: (t_1.c1 = t_2.c1)
4481    ->  Index Only Scan using t1_i1 on t1 t_1
4482    ->  Sort
4483          Sort Key: t_2.c1
4484          ->  Seq Scan on t2 t_2
4485 (6 rows)
4486
4487 /*+HashJoin(t_1 t_1)*/
4488 EXPLAIN (COSTS false)
4489  SELECT recall_planner_one_t() FROM s1.t1 t_1
4490    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4491   ORDER BY t_1.c1;
4492 LOG:  pg_hint_plan:
4493 used hint:
4494 IndexScan(t_1)
4495 not used hint:
4496 duplication hint:
4497 error hint:
4498
4499 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
4500 DETAIL:  Relation name "t_1" is duplicated.
4501 LOG:  pg_hint_plan:
4502 used hint:
4503 not used hint:
4504 duplication hint:
4505 error hint:
4506 HashJoin(t_1 t_1)
4507
4508                  QUERY PLAN                  
4509 ---------------------------------------------
4510  Merge Join
4511    Merge Cond: (t_1.c1 = t_2.c1)
4512    ->  Index Only Scan using t1_i1 on t1 t_1
4513    ->  Sort
4514          Sort Key: t_2.c1
4515          ->  Seq Scan on t2 t_2
4516 (6 rows)
4517
4518 DROP FUNCTION recall_planner_one_t(int);
4519 ERROR:  function recall_planner_one_t(integer) does not exist
4520 --No.13-4-7
4521 -- See description for No.13-4-1. Complains on the wrongly written hint.
4522 /*+HashJoin(t_1 t_1)*/
4523 EXPLAIN (COSTS false)
4524  SELECT recall_planner() FROM s1.t1 t_1
4525    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4526   ORDER BY t_1.c1;
4527 LOG:  pg_hint_plan:
4528 used hint:
4529 IndexScan(t_1)
4530 not used hint:
4531 duplication hint:
4532 error hint:
4533
4534 INFO:  pg_hint_plan: hint syntax error at or near "HashJoin(t_1 t_1)"
4535 DETAIL:  Relation name "t_1" is duplicated.
4536 LOG:  pg_hint_plan:
4537 used hint:
4538 not used hint:
4539 duplication hint:
4540 error hint:
4541 HashJoin(t_1 t_1)
4542
4543                  QUERY PLAN                  
4544 ---------------------------------------------
4545  Merge Join
4546    Merge Cond: (t_1.c1 = t_2.c1)
4547    ->  Index Only Scan using t1_i1 on t1 t_1
4548    ->  Sort
4549          Sort Key: t_2.c1
4550          ->  Seq Scan on t2 t_2
4551 (6 rows)
4552
4553 --No.13-4-8
4554 /*+MergeJoin(t_1 t_2)HashJoin(t_1 t_2)*/
4555 EXPLAIN (COSTS false)
4556  SELECT recall_planner() FROM s1.t1 t_1
4557    JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
4558   ORDER BY t_1.c1;
4559 INFO:  pg_hint_plan: hint syntax error at or near "MergeJoin(t_1 t_2)HashJoin(t_1 t_2)"
4560 DETAIL:  Conflict join method hint.
4561 LOG:  pg_hint_plan:
4562 used hint:
4563 IndexScan(t_1)
4564 not used hint:
4565 duplication hint:
4566 error hint:
4567
4568 LOG:  pg_hint_plan:
4569 used hint:
4570 HashJoin(t_1 t_2)
4571 not used hint:
4572 duplication hint:
4573 MergeJoin(t_1 t_2)
4574 error hint:
4575
4576               QUERY PLAN              
4577 --------------------------------------
4578  Sort
4579    Sort Key: t_1.c1
4580    ->  Hash Join
4581          Hash Cond: (t_1.c1 = t_2.c1)
4582          ->  Seq Scan on t1 t_1
4583          ->  Hash
4584                ->  Seq Scan on t2 t_2
4585 (7 rows)
4586
4587 --No.14-1-1 plancache invalidation
4588 CREATE TABLE s1.tpc AS SELECT a FROM generate_series(0, 999) a;
4589 CREATE INDEX ON s1.tpc(a);
4590 PREPARE p1 AS SELECT * FROM s1.tpc WHERE a < 999;
4591 /*+ IndexScan(tpc) */PREPARE p2 AS SELECT * FROM s1.tpc WHERE a < 999;
4592 /*+ SeqScan(tpc) */PREPARE p3(int) AS SELECT * FROM s1.tpc WHERE a = $1;
4593 EXPLAIN EXECUTE p1;
4594                       QUERY PLAN                      
4595 ------------------------------------------------------
4596  Seq Scan on tpc  (cost=0.00..17.50 rows=333 width=4)
4597    Filter: (a < 999)
4598 (2 rows)
4599
4600 EXPLAIN EXECUTE p2;
4601 LOG:  pg_hint_plan:
4602 used hint:
4603 IndexScan(tpc)
4604 not used hint:
4605 duplication hint:
4606 error hint:
4607
4608                                QUERY PLAN                               
4609 ------------------------------------------------------------------------
4610  Index Scan using tpc_a_idx on tpc  (cost=0.28..34.10 rows=333 width=4)
4611    Index Cond: (a < 999)
4612 (2 rows)
4613
4614 EXPLAIN EXECUTE p3(500);
4615 LOG:  pg_hint_plan:
4616 used hint:
4617 SeqScan(tpc)
4618 not used hint:
4619 duplication hint:
4620 error hint:
4621
4622                      QUERY PLAN                     
4623 ----------------------------------------------------
4624  Seq Scan on tpc  (cost=0.00..17.50 rows=5 width=4)
4625    Filter: (a = 500)
4626 (2 rows)
4627
4628 -- The DROP invalidates the plan caches
4629 DROP TABLE s1.tpc;
4630 EXPLAIN EXECUTE p1;
4631 ERROR:  relation "s1.tpc" does not exist
4632 EXPLAIN EXECUTE p2;
4633 ERROR:  relation "s1.tpc" does not exist
4634 EXPLAIN EXECUTE p3(500);
4635 ERROR:  relation "s1.tpc" does not exist
4636 CREATE TABLE s1.tpc AS SELECT a FROM generate_series(0, 999) a;
4637 CREATE INDEX ON s1.tpc(a);
4638 EXPLAIN EXECUTE p1;
4639                       QUERY PLAN                      
4640 ------------------------------------------------------
4641  Seq Scan on tpc  (cost=0.00..17.50 rows=333 width=4)
4642    Filter: (a < 999)
4643 (2 rows)
4644
4645 EXPLAIN EXECUTE p2;
4646 LOG:  pg_hint_plan:
4647 used hint:
4648 IndexScan(tpc)
4649 not used hint:
4650 duplication hint:
4651 error hint:
4652
4653                                QUERY PLAN                               
4654 ------------------------------------------------------------------------
4655  Index Scan using tpc_a_idx on tpc  (cost=0.28..34.10 rows=333 width=4)
4656    Index Cond: (a < 999)
4657 (2 rows)
4658
4659 EXPLAIN EXECUTE p3(500);
4660 LOG:  pg_hint_plan:
4661 used hint:
4662 SeqScan(tpc)
4663 not used hint:
4664 duplication hint:
4665 error hint:
4666
4667                      QUERY PLAN                     
4668 ----------------------------------------------------
4669  Seq Scan on tpc  (cost=0.00..17.50 rows=5 width=4)
4670    Filter: (a = 500)
4671 (2 rows)
4672
4673 DEALLOCATE p1;
4674 DEALLOCATE p2;
4675 DEALLOCATE p3;
4676 DROP TABLE s1.tpc;