reprise: pretty print viewdefs

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: reprise: pretty print viewdefs
Date: 2011-12-19 18:51:37
Message-ID: 4EEF87B9.50604@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

A client has again raised with me the ugliness of "pretty printed"
viewdefs. We looked at this a couple of years ago, but discussion went
off into the weeds slightly, so I dropped it, but as requested I'm
revisiting it.

The problem can be simply seen in the screenshot here:
<http://developer.postgresql.org/~adunstan/view_before.png>

This is ugly, unreadable and unusable, IMNSHO. Calling it "pretty" is
just laughable.

The simple solution I originally proposed to put a line feed and some
space before every target field in pretty print mode. This is a two line
patch. The downsides are a) maybe not everyone will like the change and
b) it will produce superfluous newlines, e.g. before CASE expressions.

We can avoid the superfluous newlines at the cost of some code
complexity. Whether it's worth it is a judgement call.

If we don't want to do this unconditionally, we'd need either a new
function which would make it available or a new flavor of pg_get_viewdef
- if the latter I'm not really sure what the new signatures should be -
oid/text | something not boolean, but what? Personally, I'd much rather
just do it. Does anyone *really* like the present output?

cheers

andrew

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2011-12-19 19:13:02 Re: pgsql_fdw, FDW for PostgreSQL server
Previous Message Greg Smith 2011-12-19 18:46:25 Re: Page Checksums