Skip site navigation (1) Skip section navigation (2)

Re: pg_dump --pretty-print-views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Marko Tiikkaja <pgmail(at)joh(dot)to>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump --pretty-print-views
Date: 2013-01-10 17:09:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
David Fetter <david(at)fetter(dot)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

In response to


pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2013-01-10 17:26:06
Subject: Re: proposal: Set effective_cache_size to greater of .conf value, shared_buffers
Previous:From: Rod TaylorDate: 2013-01-10 17:08:45
Subject: GIN over array of ENUMs

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group