@@ -364,207 +364,6 @@ SELECT max(val) FROM test.insert_date_test; /* check last date */
364
364
365
365
DROP TABLE test.insert_date_test CASCADE;
366
366
NOTICE: drop cascades to 8 other objects
367
- /* Test special case: ONLY statement with not-ONLY for partitioned table */
368
- CREATE TABLE test.from_only_test(val INT NOT NULL);
369
- INSERT INTO test.from_only_test SELECT generate_series(1, 20);
370
- SELECT pathman.create_range_partitions('test.from_only_test', 'val', 1, 2);
371
- NOTICE: sequence "from_only_test_seq" does not exist, skipping
372
- create_range_partitions
373
- -------------------------
374
- 10
375
- (1 row)
376
-
377
- /* should be OK */
378
- EXPLAIN (COSTS OFF)
379
- SELECT * FROM ONLY test.from_only_test
380
- UNION SELECT * FROM test.from_only_test;
381
- QUERY PLAN
382
- -------------------------------------------------
383
- HashAggregate
384
- Group Key: from_only_test.val
385
- -> Append
386
- -> Seq Scan on from_only_test
387
- -> Append
388
- -> Seq Scan on from_only_test_1
389
- -> Seq Scan on from_only_test_2
390
- -> Seq Scan on from_only_test_3
391
- -> Seq Scan on from_only_test_4
392
- -> Seq Scan on from_only_test_5
393
- -> Seq Scan on from_only_test_6
394
- -> Seq Scan on from_only_test_7
395
- -> Seq Scan on from_only_test_8
396
- -> Seq Scan on from_only_test_9
397
- -> Seq Scan on from_only_test_10
398
- (15 rows)
399
-
400
- /* should be OK */
401
- EXPLAIN (COSTS OFF)
402
- SELECT * FROM test.from_only_test
403
- UNION SELECT * FROM ONLY test.from_only_test;
404
- QUERY PLAN
405
- -------------------------------------------------
406
- HashAggregate
407
- Group Key: from_only_test_1.val
408
- -> Append
409
- -> Append
410
- -> Seq Scan on from_only_test_1
411
- -> Seq Scan on from_only_test_2
412
- -> Seq Scan on from_only_test_3
413
- -> Seq Scan on from_only_test_4
414
- -> Seq Scan on from_only_test_5
415
- -> Seq Scan on from_only_test_6
416
- -> Seq Scan on from_only_test_7
417
- -> Seq Scan on from_only_test_8
418
- -> Seq Scan on from_only_test_9
419
- -> Seq Scan on from_only_test_10
420
- -> Seq Scan on from_only_test
421
- (15 rows)
422
-
423
- /* should be OK */
424
- EXPLAIN (COSTS OFF)
425
- SELECT * FROM test.from_only_test
426
- UNION SELECT * FROM test.from_only_test
427
- UNION SELECT * FROM ONLY test.from_only_test;
428
- QUERY PLAN
429
- ---------------------------------------------------------------------
430
- HashAggregate
431
- Group Key: from_only_test_1.val
432
- -> Append
433
- -> Append
434
- -> Seq Scan on from_only_test_1
435
- -> Seq Scan on from_only_test_2
436
- -> Seq Scan on from_only_test_3
437
- -> Seq Scan on from_only_test_4
438
- -> Seq Scan on from_only_test_5
439
- -> Seq Scan on from_only_test_6
440
- -> Seq Scan on from_only_test_7
441
- -> Seq Scan on from_only_test_8
442
- -> Seq Scan on from_only_test_9
443
- -> Seq Scan on from_only_test_10
444
- -> Append
445
- -> Seq Scan on from_only_test_1 from_only_test_1_1
446
- -> Seq Scan on from_only_test_2 from_only_test_2_1
447
- -> Seq Scan on from_only_test_3 from_only_test_3_1
448
- -> Seq Scan on from_only_test_4 from_only_test_4_1
449
- -> Seq Scan on from_only_test_5 from_only_test_5_1
450
- -> Seq Scan on from_only_test_6 from_only_test_6_1
451
- -> Seq Scan on from_only_test_7 from_only_test_7_1
452
- -> Seq Scan on from_only_test_8 from_only_test_8_1
453
- -> Seq Scan on from_only_test_9 from_only_test_9_1
454
- -> Seq Scan on from_only_test_10 from_only_test_10_1
455
- -> Seq Scan on from_only_test
456
- (26 rows)
457
-
458
- /* should be OK */
459
- EXPLAIN (COSTS OFF)
460
- SELECT * FROM ONLY test.from_only_test
461
- UNION SELECT * FROM test.from_only_test
462
- UNION SELECT * FROM test.from_only_test;
463
- QUERY PLAN
464
- ---------------------------------------------------------------------
465
- HashAggregate
466
- Group Key: from_only_test.val
467
- -> Append
468
- -> Seq Scan on from_only_test
469
- -> Append
470
- -> Seq Scan on from_only_test_1
471
- -> Seq Scan on from_only_test_2
472
- -> Seq Scan on from_only_test_3
473
- -> Seq Scan on from_only_test_4
474
- -> Seq Scan on from_only_test_5
475
- -> Seq Scan on from_only_test_6
476
- -> Seq Scan on from_only_test_7
477
- -> Seq Scan on from_only_test_8
478
- -> Seq Scan on from_only_test_9
479
- -> Seq Scan on from_only_test_10
480
- -> Append
481
- -> Seq Scan on from_only_test_1 from_only_test_1_1
482
- -> Seq Scan on from_only_test_2 from_only_test_2_1
483
- -> Seq Scan on from_only_test_3 from_only_test_3_1
484
- -> Seq Scan on from_only_test_4 from_only_test_4_1
485
- -> Seq Scan on from_only_test_5 from_only_test_5_1
486
- -> Seq Scan on from_only_test_6 from_only_test_6_1
487
- -> Seq Scan on from_only_test_7 from_only_test_7_1
488
- -> Seq Scan on from_only_test_8 from_only_test_8_1
489
- -> Seq Scan on from_only_test_9 from_only_test_9_1
490
- -> Seq Scan on from_only_test_10 from_only_test_10_1
491
- (26 rows)
492
-
493
- /* not ok, ONLY|non-ONLY in one query */
494
- EXPLAIN (COSTS OFF)
495
- SELECT * FROM test.from_only_test a JOIN ONLY test.from_only_test b USING(val);
496
- ERROR: it is prohibited to apply ONLY modifier to partitioned tables which have already been mentioned without ONLY
497
- EXPLAIN (COSTS OFF)
498
- WITH q1 AS (SELECT * FROM test.from_only_test),
499
- q2 AS (SELECT * FROM ONLY test.from_only_test)
500
- SELECT * FROM q1 JOIN q2 USING(val);
501
- QUERY PLAN
502
- ---------------------------------------------
503
- Hash Join
504
- Hash Cond: (q1.val = q2.val)
505
- CTE q1
506
- -> Append
507
- -> Seq Scan on from_only_test_1
508
- -> Seq Scan on from_only_test_2
509
- -> Seq Scan on from_only_test_3
510
- -> Seq Scan on from_only_test_4
511
- -> Seq Scan on from_only_test_5
512
- -> Seq Scan on from_only_test_6
513
- -> Seq Scan on from_only_test_7
514
- -> Seq Scan on from_only_test_8
515
- -> Seq Scan on from_only_test_9
516
- -> Seq Scan on from_only_test_10
517
- CTE q2
518
- -> Seq Scan on from_only_test
519
- -> CTE Scan on q1
520
- -> Hash
521
- -> CTE Scan on q2
522
- (19 rows)
523
-
524
- EXPLAIN (COSTS OFF)
525
- WITH q1 AS (SELECT * FROM ONLY test.from_only_test)
526
- SELECT * FROM test.from_only_test JOIN q1 USING(val);
527
- QUERY PLAN
528
- ----------------------------------------------
529
- Hash Join
530
- Hash Cond: (from_only_test_1.val = q1.val)
531
- CTE q1
532
- -> Seq Scan on from_only_test
533
- -> Append
534
- -> Seq Scan on from_only_test_1
535
- -> Seq Scan on from_only_test_2
536
- -> Seq Scan on from_only_test_3
537
- -> Seq Scan on from_only_test_4
538
- -> Seq Scan on from_only_test_5
539
- -> Seq Scan on from_only_test_6
540
- -> Seq Scan on from_only_test_7
541
- -> Seq Scan on from_only_test_8
542
- -> Seq Scan on from_only_test_9
543
- -> Seq Scan on from_only_test_10
544
- -> Hash
545
- -> CTE Scan on q1
546
- (17 rows)
547
-
548
- EXPLAIN (COSTS OFF)
549
- SELECT * FROM test.range_rel WHERE id = (SELECT id FROM ONLY test.range_rel LIMIT 1);
550
- QUERY PLAN
551
- --------------------------------------------------------
552
- Append
553
- InitPlan 1 (returns $0)
554
- -> Limit
555
- -> Seq Scan on range_rel
556
- -> Index Scan using range_rel_1_pkey on range_rel_1
557
- Index Cond: (id = $0)
558
- -> Index Scan using range_rel_2_pkey on range_rel_2
559
- Index Cond: (id = $0)
560
- -> Index Scan using range_rel_3_pkey on range_rel_3
561
- Index Cond: (id = $0)
562
- -> Index Scan using range_rel_4_pkey on range_rel_4
563
- Index Cond: (id = $0)
564
- (12 rows)
565
-
566
- DROP TABLE test.from_only_test CASCADE;
567
- NOTICE: drop cascades to 10 other objects
568
367
SET pg_pathman.enable_runtimeappend = OFF;
569
368
SET pg_pathman.enable_runtimemergeappend = OFF;
570
369
VACUUM;
0 commit comments