Re: pg_get_viewdefs() indentation considered harmful

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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-04-16 22:42:04
Message-ID: 20140416224204.GK7443@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 25, 2014 at 01:02:36PM -0500, Andrew Dunstan wrote:
>
> On 01/25/2014 11:06 AM, Tom Lane wrote:
> >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?
> >
> >
>
>
> Simply capping it is probably the best bang for the buck. I suspect
> most people would prefer to have "q1 union q2 union q3 union q4"
> with the subqueries all indented to the same level. But I understand
> the difficulties in doing so.
>
> A knob seems like overkill. I'd just hardwire some number, say three
> or four levels of indentation.

Did we address this?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2014-04-16 22:55:14 Re: shouldn't we log permission errors when accessing the configured trigger file?
Previous Message Bruce Momjian 2014-04-16 22:15:13 Re: improve the help message about psql -F