Re: pretty print viewdefs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pretty print viewdefs
Date
Msg-id 23972.1251327321@sss.pgh.pa.us
Whole thread Raw
In response to Re: pretty print viewdefs  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: pretty print viewdefs  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.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?

> 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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: MySQL Compatibility WAS: 8.5 release timetable, again
Next
From: Andrew Dunstan
Date:
Subject: Re: pretty print viewdefs