Re: pretty print viewdefs - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: pretty print viewdefs
Date
Msg-id 162867790908260755k1eba4f3dn8d0ef59ea6f23745@mail.gmail.com
Whole thread Raw
In response to pretty print viewdefs  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: pretty print viewdefs  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
2009/8/26 Andrew Dunstan <andrew@dunslane.net>:
>
> [originally sent from wrong account :-( ]
>
>
> The tiny patch attached fixes a long-standing peeve of mine (and at least
> one of my clients'), namely that the target list printed in viewdefs are
> unreadable.
>
> example output now looks like this:
>
>   regression=# select pg_get_viewdef('shoe',true);
>                   pg_get_viewdef
> -----------------------------------------------
>     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;
>
>

I am not sure - this should by task for client application. 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.

> Is there any objection?

I thing so default should be unformated with some pretty printing support.

regards
Pavel Stehule

>
> cheers
>
> andrew
>
>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>


pgsql-hackers by date:

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