Re: pg_get_viewdefs() indentation considered harmful

From: Greg Stark <stark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_get_viewdefs() indentation considered harmful
Date: 2014-04-29 23:49:24
Message-ID: CAM-w4HNiGkxGGtrRcmK1-FNDf4spvRL+vS-ri_o22OKErV+EGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 29, 2014 at 7:46 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I doubt you can do that (the half-size-step bit), at least not without
> a much larger patch than this: there are assorted places that just
> unconditionally append PRETTYINDENT_STD spaces, and would have to be
> taught to do something different. OTOH those places might need to be
> adjusted anyway.

As far as I can see this is the only place that needs to be adjusted.
That function handles pretty much all the indentation. The only other
places that insert spaces just insert a fixed number in strings like
CREATE FUNCTION before the LANGUAGE or CREATE RULE before the ON.

Actually the only thing that might want to be adjusted is the
indentation in the beginning of the setop (ruleutils.c:4720) which is
what causes that long line of parentheses at the beginning of the
example. I suppose in an ideal world it would start following the
reduced spacing and wrap to new lines whenever the indentation goes
back to the left. But I can't get too excited by it in the example and
I'm not sure it's even intended to line up anyways. It just inserts
STD spaces without a newline.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-04-30 00:05:44 Re: pg_get_viewdefs() indentation considered harmful
Previous Message Tom Lane 2014-04-29 23:44:33 Re: pg_dump --pretty-print-views