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