- Notifications
You must be signed in to change notification settings - Fork5
Commit41de93c
committed
Reduce indentation/parenthesization of set operations in rule/view dumps.
A query such as "SELECT x UNION SELECT y UNION SELECT z UNION ..."produces a left-deep nested parse tree, which we formerly showed in itsfull nested glory and with all the possible parentheses. This does littlefor readability, though, and long UNION lists resulting in excessiveindentation are common. Instead, let's omit parentheses and indent allthe subqueries at the same level in such cases.This patch skips indentation/parenthesization whenever the lefthand inputof a SetOperationStmt is another SetOperationStmt of the same kind andALL/DISTINCT property. We could teach the code the exact syntacticprecedence of set operations and thereby avoid parenthesization in somemore cases, but it's not clear that that'd be a readability win: it seemsbetter to parenthesize if the set operation changes. (As an example,if there's one UNION in a long list of UNION ALL, it now stands out likea sore thumb, which seems like a good thing.)Back-patch to 9.3. This completes our response to a complaint from GregStark that since commit62e6664 there's a performance problem in pg_dumpfor views containing long UNION sequences (or other types of deeply nestedconstructs). The previous commit0601cb5handles the general problem, but this one makes the specific case of UNIONlists look a lot nicer.1 parent0601cb5 commit41de93c
File tree
5 files changed
+390
-363
lines changed- src
- backend/utils/adt
- test/regress/expected
5 files changed
+390
-363
lines changedLines changed: 54 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4714 | 4714 |
| |
4715 | 4715 |
| |
4716 | 4716 |
| |
4717 |
| - | |
4718 |
| - | |
4719 |
| - | |
4720 |
| - | |
4721 |
| - | |
4722 |
| - | |
| 4717 | + | |
4723 | 4718 |
| |
4724 | 4719 |
| |
4725 |
| - | |
4726 |
| - | |
4727 |
| - | |
4728 |
| - | |
| 4720 | + | |
| 4721 | + | |
| 4722 | + | |
| 4723 | + | |
| 4724 | + | |
| 4725 | + | |
| 4726 | + | |
| 4727 | + | |
| 4728 | + | |
4729 | 4729 |
| |
4730 |
| - | |
| 4730 | + | |
| 4731 | + | |
| 4732 | + | |
| 4733 | + | |
| 4734 | + | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
4731 | 4741 |
| |
4732 | 4742 |
| |
| 4743 | + | |
4733 | 4744 |
| |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
4734 | 4751 |
| |
4735 |
| - | |
4736 |
| - | |
4737 | 4752 |
| |
4738 |
| - | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
4739 | 4758 |
| |
| 4759 | + | |
4740 | 4760 |
| |
4741 | 4761 |
| |
4742 | 4762 |
| |
4743 |
| - | |
4744 |
| - | |
| 4763 | + | |
4745 | 4764 |
| |
4746 | 4765 |
| |
4747 |
| - | |
4748 |
| - | |
| 4766 | + | |
4749 | 4767 |
| |
4750 | 4768 |
| |
4751 |
| - | |
4752 |
| - | |
| 4769 | + | |
4753 | 4770 |
| |
4754 | 4771 |
| |
4755 | 4772 |
| |
| |||
4758 | 4775 |
| |
4759 | 4776 |
| |
4760 | 4777 |
| |
4761 |
| - | |
4762 |
| - | |
4763 |
| - | |
4764 |
| - | |
| 4778 | + | |
| 4779 | + | |
4765 | 4780 |
| |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | + | |
4766 | 4786 |
| |
| 4787 | + | |
4767 | 4788 |
| |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
| 4793 | + | |
| 4794 | + | |
4768 | 4795 |
| |
4769 |
| - | |
4770 |
| - | |
4771 | 4796 |
| |
4772 | 4797 |
| |
4773 |
| - | |
| 4798 | + | |
| 4799 | + | |
| 4800 | + | |
4774 | 4801 |
| |
4775 | 4802 |
| |
4776 | 4803 |
| |
|
0 commit comments
Comments
(0)