Re: pg_dump --pretty-print-views
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <stark@mit.edu>
Cc: Keith Fiske <keith@omniti.com>, Marko Tiikkaja <pgmail@joh.to>,
Jeevan Chalke <jeevan.chalke@enterprisedb.com>,
Andrew Dunstan <andrew@dunslane.net>, David Fetter <david@fetter.org>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2014-04-29T21:22:54Z
Lists: pgsql-hackers
Attachments
- union-indentation-fix-1.patch (text/x-diff) patch
I wrote: > I'm still a bit skeptical about this being a catastrophic problem in > practice ... but anyway, I thought there were two somewhat different > proposals on the table in that thread: > 1. Arrange for "x UNION y UNION z ..." to put all the UNION arms at > the same indentation level. > 2. Change the indentation rules globally, in one or another fashion > as Greg mentions above, to prevent ruleutils from ever prepending > silly amounts of whitespace. > These are not mutually exclusive, and I think we should do both. Here's a draft patch tackling point 1. This gets rid of a whole lot of parenthesization, as well as indentation, for simple UNION lists. You can see the results in the changed regression test outputs. There are still a few oddities in the printout format, such as the forced space between ( and SELECT at the start of a subquery; but changing that would require touching more than just get_setop_query(), and I'm not too sure what else would be affected, so I let it be. While I was testing this I noticed that there's something thoroughly busted about the indentation of outer JOIN constructs, too --- you can see this in some of the regression test queries that are touched by this patch, where the JOINs are actually outdented to the left of their FROM clause in the unpatched output. (They'd be outdented in the new output, too, if negative indentation were possible...) That seems like material for a separate patch though. Comments? regards, tom lane