Re: pretty print viewdefs

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pretty print viewdefs
Date: 2009-08-26 14:55:52
Message-ID: 162867790908260755k1eba4f3dn8d0ef59ea6f23745@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/8/26 Andrew Dunstan <andrew(at)dunslane(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chander Ganesan 2009-08-26 15:05:38 Re: We should Axe /contrib/start-scripts
Previous Message Tom Lane 2009-08-26 14:55:45 Re: pretty print viewdefs