Re: pretty print viewdefs - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: pretty print viewdefs
Date
Msg-id 4A954F92.5010405@dunslane.net
Whole thread Raw
In response to Re: pretty print viewdefs  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: pretty print viewdefs  (Andreas Pflug <pgadmin@pse-consulting.de>)
List pgsql-hackers

Pavel Stehule wrote:
> I am not sure - this should by task for client application. 


pg_get_viewdef() already has a pretty print mode, and this change would 
only affect output from that mode. Non-pretty printed output would be 
unchanged.

My argument is that the pretty print mode for target lists is not at all 
pretty.

I don't see why this has the be invented in every client. Then we'd have 
to do it in psql, pg_dump and so on. If any client doesn't like our 
pretty print output it can get the raw viewdef and do its own formatting.

> But Pg
> should have some pretty print function - it is easy implemented there.
> Personally, I prefere Celko's notation, it is little bit more compact
>
> 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;
>
> but, sure - this is my personal preference.
>   


To do that we would need to keep track of how much space was used on the 
line and how much space what we were adding would use. It's doable, but 
it's a lot more work.


>   
>> Is there any objection?
>>     
>
> I thing so default should be unformated with some pretty printing support.
>
>   
>

Please look at the function definition. You already have the option of 
formatted or unformatted output.

cheers

andrew


pgsql-hackers by date:

Previous
From: Chander Ganesan
Date:
Subject: Re: We should Axe /contrib/start-scripts
Next
From: Tom Lane
Date:
Subject: Re: We should Axe /contrib/start-scripts