Re: pg_dump --pretty-print-views
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Fetter <david@fetter.org>
Cc: Marko Tiikkaja <pgmail@joh.to>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2013-01-10T17:09:15Z
Lists: pgsql-hackers
David Fetter <david@fetter.org> writes: > On Thu, Jan 10, 2013 at 11:21:13AM -0500, Tom Lane wrote: >> -1. The reason that pg_dump does not pretty-print things is that >> it's unsafe; there is no real guarantee that the view will reload as >> intended, because it's under-parenthesized. (Even if we were sure >> it would reload safely into current code, which I'm not, what of >> future versions that could have different operator precedences?) > Under what circumstances do pretty-printed views not reload? It seems > to me that such circumstances would be pretty_print() bugs by > definition. It would not be a bug, particularly not in the case of a subsequent release with different operator precedence. pg_dump's charter is to be safe. Pretty-printing's charter is to look nice. These goals are not compatible. If they were, we'd never have made a separate pretty printing mode at all. Now, we could consider changing the "safe" mode so that it tries to provide nice whitespace/line breaks while not risking removal of parentheses. But that would be a totally different patch, and I'm not sure how much it would address Marko's desires anyway. regards, tom lane