Re: pretty print viewdefs

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, decibel <decibel(at)decibel(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pretty print viewdefs
Date: 2009-08-26 23:12:42
Message-ID: 4A95C16A.6090706@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> I do have a solution that wraps when running line length over 80 instead
>> of on every col:
>>
>
>
>> SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen,
>> sh.slminlen * un.un_fact AS slminlen_cm, sh.slmaxlen,
>> sh.slmaxlen * un.un_fact AS slmaxlen_cm, sh.slunit
>> FROM shoe_data sh, unit un
>> WHERE sh.slunit = un.un_name;
>>
>
>
>> It's not a huge amount of code.
>>
>
> Well, let's see it? What do you do with expressions that don't fit?
>

See attached.

We don't apply the wrapping unless there has been a column printed on
the line (except for the SELECT line).

So we can run over the limit on a line, but if we do there's only one
column spec. I think that's acceptable.

>
>> 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.
>>
>
> pg_dump doesn't use prettyprinting at all, and won't if I have anything
> to say about it. But I could see teaching the psql \d views to pass
> along whatever psql thinks the window width is.
>
>
>

OK, but I'd still like to have the only one col per line variant available.

cheers

andrew

Attachment Content-Type Size
prettyprint.patch text/x-patch 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-08-26 23:25:44 Re: 8.5 release timetable, again
Previous Message Tom Lane 2009-08-26 22:55:21 Re: pretty print viewdefs