Re: pretty print viewdefs - Mailing list pgsql-hackers

From Greg Stark
Subject Re: pretty print viewdefs
Date
Msg-id 407d949e0908261629y35020f8fi57c289db8a9b420a@mail.gmail.com
Whole thread Raw
In response to Re: pretty print viewdefs  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: pretty print viewdefs
List pgsql-hackers
On Wed, Aug 26, 2009 at 11:49 PM, Andrew Dunstan<andrew@dunslane.net> wrote:
> Maybe we need a couple of extra pg_get_viewdef() variants. One to wrap on
> some provided line length, one to wrap on every column. psql could use the
> first, pg_dump could use the second.
>
> I really can't believe anyone wants a single line with 1600 column specs ...

Uhm, why not? People generally don't care about the list of columns at
all if it's just generated by "select *". If they're reading it at all
it's to see the WHERE clauses and FROM clauses and so on.

I think wrapping it at 80 columns gets the worst of both worlds. Then
you have dozens or even hundreds of lines just listing columns making
it hard to see the rest of the query. At least if it's all on one line
you can just not scroll to the right and see the rest of the query on
your screen.

An alternative to my previous compromise which might be more consistent:

List the columns one per line if *any* of the columns has an alias or
is a complex expression. If they're all simple columns then put them
all one line.

At least that way you won't have any weird column lists that switch
back and forth between styles.

-- 
greg
http://mit.edu/~gsstark/resume.pdf


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: 8.5 release timetable, again
Next
From: Peter Eisentraut
Date:
Subject: Re: Logging configuration changes