| 562 | +(1 row) |
| 563 | + |
| 564 | +-- non-hashable type |
| 565 | +explain (costs off) |
| 566 | +select x from (values (array[100::money]), (array[200::money])) _(x) union select x from (values (array[100::money]), (array[300::money])) _(x); |
| 567 | + QUERY PLAN |
| 568 | +----------------------------------------------- |
| 569 | + Unique |
| 570 | + -> Sort |
| 571 | + Sort Key: "*VALUES*".column1 |
| 572 | + -> Append |
| 573 | + -> Values Scan on "*VALUES*" |
| 574 | + -> Values Scan on "*VALUES*_1" |
| 575 | +(6 rows) |
| 576 | + |
| 577 | +select x from (values (array[100::money]), (array[200::money])) _(x) union select x from (values (array[100::money]), (array[300::money])) _(x); |
| 578 | + x |
| 579 | +----------- |
| 580 | + {$100.00} |
| 581 | + {$200.00} |
| 582 | + {$300.00} |
| 583 | +(3 rows) |
| 584 | + |
| 585 | +set enable_hashagg to off; |
| 586 | +explain (costs off) |
| 587 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) union select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 588 | + QUERY PLAN |
| 589 | +----------------------------------------------- |
| 590 | + Unique |
| 591 | + -> Sort |
| 592 | + Sort Key: "*VALUES*".column1 |
| 593 | + -> Append |
| 594 | + -> Values Scan on "*VALUES*" |
| 595 | + -> Values Scan on "*VALUES*_1" |
| 596 | +(6 rows) |
| 597 | + |
| 598 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) union select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 599 | + x |
| 600 | +------- |
| 601 | + {1,2} |
| 602 | + {1,3} |
| 603 | + {1,4} |
| 604 | +(3 rows) |
| 605 | + |
| 606 | +explain (costs off) |
| 607 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) intersect select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 608 | + QUERY PLAN |
| 609 | +----------------------------------------------------- |
| 610 | + SetOp Intersect |
| 611 | + -> Sort |
| 612 | + Sort Key: "*SELECT* 1".x |
| 613 | + -> Append |
| 614 | + -> Subquery Scan on "*SELECT* 1" |
| 615 | + -> Values Scan on "*VALUES*" |
| 616 | + -> Subquery Scan on "*SELECT* 2" |
| 617 | + -> Values Scan on "*VALUES*_1" |
| 618 | +(8 rows) |
| 619 | + |
| 620 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) intersect select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 621 | + x |
| 622 | +------- |
| 623 | + {1,2} |
| 624 | +(1 row) |
| 625 | + |
| 626 | +explain (costs off) |
| 627 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) except select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 628 | + QUERY PLAN |
| 629 | +----------------------------------------------------- |
| 630 | + SetOp Except |
| 631 | + -> Sort |
| 632 | + Sort Key: "*SELECT* 1".x |
| 633 | + -> Append |
| 634 | + -> Subquery Scan on "*SELECT* 1" |
| 635 | + -> Values Scan on "*VALUES*" |
| 636 | + -> Subquery Scan on "*SELECT* 2" |
| 637 | + -> Values Scan on "*VALUES*_1" |
| 638 | +(8 rows) |
| 639 | + |
| 640 | +select x from (values (array[1, 2]), (array[1, 3])) _(x) except select x from (values (array[1, 2]), (array[1, 4])) _(x); |
| 641 | + x |
| 642 | +------- |
| 643 | + {1,3} |
| 644 | +(1 row) |
| 645 | + |
| 646 | +reset enable_hashagg; |
| 647 | +-- records |
| 648 | +set enable_hashagg to on; |
| 649 | +-- currently no hashing support for record, so these will still run with sort plans: |
| 650 | +explain (costs off) |
| 651 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 652 | + QUERY PLAN |
| 653 | +----------------------------------------------- |
| 654 | + Unique |
| 655 | + -> Sort |
| 656 | + Sort Key: "*VALUES*".column1 |
| 657 | + -> Append |
| 658 | + -> Values Scan on "*VALUES*" |
| 659 | + -> Values Scan on "*VALUES*_1" |
| 660 | +(6 rows) |
| 661 | + |
| 662 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 663 | + x |
| 664 | +------- |
| 665 | + (1,2) |
| 666 | + (1,3) |
| 667 | + (1,4) |
| 668 | +(3 rows) |
| 669 | + |
| 670 | +explain (costs off) |
| 671 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 672 | + QUERY PLAN |
| 673 | +----------------------------------------------------- |
| 674 | + SetOp Intersect |
| 675 | + -> Sort |
| 676 | + Sort Key: "*SELECT* 1".x |
| 677 | + -> Append |
| 678 | + -> Subquery Scan on "*SELECT* 1" |
| 679 | + -> Values Scan on "*VALUES*" |
| 680 | + -> Subquery Scan on "*SELECT* 2" |
| 681 | + -> Values Scan on "*VALUES*_1" |
| 682 | +(8 rows) |
| 683 | + |
| 684 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 685 | + x |
| 686 | +------- |
| 687 | + (1,2) |
| 688 | +(1 row) |
| 689 | + |
| 690 | +explain (costs off) |
| 691 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 692 | + QUERY PLAN |
| 693 | +----------------------------------------------------- |
| 694 | + SetOp Except |
| 695 | + -> Sort |
| 696 | + Sort Key: "*SELECT* 1".x |
| 697 | + -> Append |
| 698 | + -> Subquery Scan on "*SELECT* 1" |
| 699 | + -> Values Scan on "*VALUES*" |
| 700 | + -> Subquery Scan on "*SELECT* 2" |
| 701 | + -> Values Scan on "*VALUES*_1" |
| 702 | +(8 rows) |
| 703 | + |
| 704 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 705 | + x |
| 706 | +------- |
| 707 | + (1,3) |
| 708 | +(1 row) |
| 709 | + |
| 710 | +-- non-hashable type |
| 711 | +explain (costs off) |
| 712 | +select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x); |
| 713 | + QUERY PLAN |
| 714 | +----------------------------------------------- |
| 715 | + Unique |
| 716 | + -> Sort |
| 717 | + Sort Key: "*VALUES*".column1 |
| 718 | + -> Append |
| 719 | + -> Values Scan on "*VALUES*" |
| 720 | + -> Values Scan on "*VALUES*_1" |
| 721 | +(6 rows) |
| 722 | + |
| 723 | +select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x); |
| 724 | + x |
| 725 | +----------- |
| 726 | + ($100.00) |
| 727 | + ($200.00) |
| 728 | + ($300.00) |
| 729 | +(3 rows) |
| 730 | + |
| 731 | +set enable_hashagg to off; |
| 732 | +explain (costs off) |
| 733 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 734 | + QUERY PLAN |
| 735 | +----------------------------------------------- |
| 736 | + Unique |
| 737 | + -> Sort |
| 738 | + Sort Key: "*VALUES*".column1 |
| 739 | + -> Append |
| 740 | + -> Values Scan on "*VALUES*" |
| 741 | + -> Values Scan on "*VALUES*_1" |
| 742 | +(6 rows) |
| 743 | + |
| 744 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) union select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 745 | + x |
17AE
| 746 | +------- |
| 747 | + (1,2) |
| 748 | + (1,3) |
| 749 | + (1,4) |
| 750 | +(3 rows) |
| 751 | + |
| 752 | +explain (costs off) |
| 753 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 754 | + QUERY PLAN |
| 755 | +----------------------------------------------------- |
| 756 | + SetOp Intersect |
| 757 | + -> Sort |
| 758 | + Sort Key: "*SELECT* 1".x |
| 759 | + -> Append |
| 760 | + -> Subquery Scan on "*SELECT* 1" |
| 761 | + -> Values Scan on "*VALUES*" |
| 762 | + -> Subquery Scan on "*SELECT* 2" |
| 763 | + -> Values Scan on "*VALUES*_1" |
| 764 | +(8 rows) |
| 765 | + |
| 766 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) intersect select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 767 | + x |
| 768 | +------- |
| 769 | + (1,2) |
| 770 | +(1 row) |
| 771 | + |
| 772 | +explain (costs off) |
| 773 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 774 | + QUERY PLAN |
| 775 | +----------------------------------------------------- |
| 776 | + SetOp Except |
| 777 | + -> Sort |
| 778 | + Sort Key: "*SELECT* 1".x |
| 779 | + -> Append |
| 780 | + -> Subquery Scan on "*SELECT* 1" |
| 781 | + -> Values Scan on "*VALUES*" |
| 782 | + -> Subquery Scan on "*SELECT* 2" |
| 783 | + -> Values Scan on "*VALUES*_1" |
| 784 | +(8 rows) |
| 785 | + |
| 786 | +select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (values (row(1, 2)), (row(1, 4))) _(x); |
| 787 | + x |
| 788 | +------- |
| 789 | + (1,3) |
| 790 | +(1 row) |
| 791 | + |
437 | 792 | reset enable_hashagg;
|
438 | 793 | --
|
439 | 794 | -- Mixed types
|
|
0 commit comments