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

Re: reprise: pretty print viewdefs

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reprise: pretty print viewdefs
Date: 2011-12-25 16:22:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

On 12/24/2011 02:26 PM, Greg Stark wrote:
> On Thu, Dec 22, 2011 at 5:52 PM, Andrew Dunstan<andrew(at)dunslane(dot)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 field would cause an
          * overflow or the last field  had a multiline spec.

Here's an illustration: 



In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-12-25 19:37:45
Subject: Re: 16-bit page checksums for 9.2
Previous:From: Martijn van OosterhoutDate: 2011-12-25 15:25:19
Subject: Re: 16-bit page checksums for 9.2

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