Re: reprise: pretty print viewdefs
| От | Andrew Dunstan |
|---|---|
| Тема | Re: reprise: pretty print viewdefs |
| Дата | |
| Msg-id | 4EF74DB5.8090403@dunslane.net обсуждение исходный текст |
| Ответ на | Re: reprise: pretty print viewdefs (Greg Stark <stark@mit.edu>) |
| Список | pgsql-hackers |
On 12/24/2011 02:26 PM, Greg Stark wrote:
> On Thu, Dec 22, 2011 at 5:52 PM, Andrew Dunstan<andrew@dunslane.net> wrote:
>> I've looked at that, and it was discussed a bit previously. It's more
>> complex because it requires that we keep track of (or calculate) where we
>> are on the line,
> You might try a compromise, just spit out all the columns on one line
> *unless* either the previous or next column is longer than something
> like 30 columns. So if you have a long list of short columns it just
> gets wrapped by your terminal but if you have complex expressions like
> CASE expressions or casts or so on they go on a line by themselves.
I think that sounds too complex, honestly. Here's what I have working:
/* * If the field we're adding already has a leading newline * or wrap mode is disabled
(pretty_wrap< 0), don't add one. * Otherwise, add one, plus some indentation, * if either the new
fieldwould cause an * overflow or the last field had a multiline spec. */
Here's an illustration:
<http://developer.postgresql.org/~adunstan/pg_get_viewdef.png>
cheers
andrew
В списке pgsql-hackers по дате отправления: