Re: pretty print viewdefs

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pretty print viewdefs
Date: 2009-08-26 15:06:58
Message-ID: 4A954F92.5010405@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-26 15:09:58 Re: We should Axe /contrib/start-scripts
Previous Message Chander Ganesan 2009-08-26 15:05:38 Re: We should Axe /contrib/start-scripts