postgresql/src
Tom Lane 41de93c53a 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 its
full nested glory and with all the possible parentheses.  This does little
for readability, though, and long UNION lists resulting in excessive
indentation are common.  Instead, let's omit parentheses and indent all
the subqueries at the same level in such cases.

This patch skips indentation/parenthesization whenever the lefthand input
of a SetOperationStmt is another SetOperationStmt of the same kind and
ALL/DISTINCT property.  We could teach the code the exact syntactic
precedence of set operations and thereby avoid parenthesization in some
more cases, but it's not clear that that'd be a readability win: it seems
better 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 like
a sore thumb, which seems like a good thing.)

Back-patch to 9.3.  This completes our response to a complaint from Greg
Stark that since commit 62e666400d there's a performance problem in pg_dump
for views containing long UNION sequences (or other types of deeply nested
constructs).  The previous commit 0601cb54da
handles the general problem, but this one makes the specific case of UNION
lists look a lot nicer.
2014-04-30 13:26:26 -04:00
..
backend Reduce indentation/parenthesization of set operations in rule/view dumps. 2014-04-30 13:26:26 -04:00
bin Fix uninitialized-variable warnings induced by recent commit. 2014-04-30 11:15:15 -04:00
common Don't #include utils/palloc.h in common/fe_memutils.h. 2014-04-26 14:14:28 -04:00
include Can't completely get rid of #ifndef FRONTEND in palloc.h :-( 2014-04-27 21:24:19 -04:00
interfaces ecpg: Add additional files to .gitignore 2014-04-23 13:30:36 -04:00
makefiles Flush a stray definition of $(DLLTOOL). 2014-02-11 12:59:48 -05:00
pl PL/Python: Adjust the regression tests for Python 3.4 2014-04-29 22:16:16 -04:00
port Preserve errno across free(). 2014-04-04 19:07:37 -04:00
template Revert to using --enable-auto-import in Cygwin builds. 2014-02-16 15:14:04 -05:00
test Reduce indentation/parenthesization of set operations in rule/view dumps. 2014-04-30 13:26:26 -04:00
timezone Update time zone data files to tzdata release 2014a. 2014-03-15 13:36:07 -04:00
tools Properly build pg_recvlogical in the msvc build system 2014-04-24 09:31:29 +02:00
tutorial Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in build: add EXTRA_REGRESS_OPTS to all pg_regress invocations 2014-04-22 18:13:10 -04:00
Makefile.shlib Tweak position of $(DLL_DEFFILE) in shared-library link commands. 2014-02-12 11:22:23 -05:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00