Re: pg_dump --pretty-print-views

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marko Tiikkaja <pgmail@joh.to>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2013-01-10T16:21:13Z
Lists: pgsql-hackers
Marko Tiikkaja <pgmail@joh.to> writes:
> While we can do the actual splitting of objects from a -Fc dump 
> relatively easily, we can't fix the view definitions after they've been 
> dumped.  So I'm proposing a --pretty-print-views setting to pg_dump 
> (patch attached).

-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?)

I don't think we should offer a foot-gun option like this at all,
and as for making it the default, not bloody likely.

I think your schema-diffing needs would be better served by a tool
specifically directed at that problem; which pg_dump is not, but
I believe there are some out there.

			regards, tom lane