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?



Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to