Re: pg_get_viewdefs() indentation considered harmful - Mailing list pgsql-hackers

From Greg Stark
Subject Re: pg_get_viewdefs() indentation considered harmful
Date
Msg-id CAM-w4HNiGkxGGtrRcmK1-FNDf4spvRL+vS-ri_o22OKErV+EGg@mail.gmail.com
Whole thread Raw
In response to Re: pg_get_viewdefs() indentation considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_get_viewdefs() indentation considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Apr 29, 2014 at 7:46 PM, Tom Lane <tgl@sss.pgh.pa.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump --pretty-print-views
Next
From: Tom Lane
Date:
Subject: Re: pg_get_viewdefs() indentation considered harmful