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-29T23:44:33Z
Lists: pgsql-hackers
Attachments
- join-indentation-fix-1.patch (text/x-diff) patch
- join-indentation-fix-2.patch (text/x-diff) patch
I wrote: > 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. I poked into that too, and found that it seems to have been busted from the very beginning. There's a unmatched subtraction of PRETTYINDENT_JOIN_ON from the indentLevel, which I suppose must be an accidental leftover from some previous version of the logic. And the code is also trying to outdent JOIN clauses further than the corresponding FROM, which seems unintuitive to me, even when the FROM is indented far enough to make it possible (which it generally isn't in simple views). Attached are two separate versions of a repair patch. The first one causes JOIN clauses to be indented the same as their parent FROM. The second one moves them over an additional 5 spaces. I find the second layout more sensible, but it does result in significantly more changes in the regression test outputs, as you can see. Comments? regards, tom lane