Re: pg_get_viewdefs() indentation considered harmful

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_get_viewdefs() indentation considered harmful
Date: 2014-01-25 16:06:34
Message-ID: 27089.1390665994@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Fri, Jan 24, 2014 at 8:53 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
>> Indeed even aside from the performance questions, once you're indented
>> 5-10 times the indention stops being useful at all. The query would
>> probably be even more readable if we just made indentation modulo 40
>> so once you get too far indented it "wraps around" which is not unlike
>> how humans actually indent things in this case.

> Ha! That seems a little crazy, but *capping* the indentation at some
> reasonable value might not be dumb.

I could go for either of those approaches, if applied uniformly, and
actually Greg's suggestion sounds a bit better: it seems more likely
to preserve some readability in deeply nested constructs.

With either approach you need to ask where the limit value is going
to come from. Is it OK to just hard-wire a magic number, or do we
need to expose a knob somewhere?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-25 16:24:19 Re: [COMMITTERS] pgsql: libpq: Support TLS versions beyond TLSv1.
Previous Message Craig Ringer 2014-01-25 14:41:19 Re: [bug fix] postgres.exe fails to start on Windows Server 2012 due to ASLR