Re: Autoformatting

From: Robert Eckhardt <reckhardt(at)pivotal(dot)io>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Shirley Wang <swang(at)pivotal(dot)io>, Raffi Holzer <rholzer(at)pivotal(dot)io>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Autoformatting
Date: 2017-05-28 15:54:15
Message-ID: CAAtBm9W26mkG-fhT=tGdOOpZfs=nirUxV_RKYc+TU6XwEt964A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Tue, May 9, 2017 at 4:26 AM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

>
> Anyhoo, The standard we try to use in pgAdmin at the moment is slightly
> different from the example you've given. To add it into the mix...
>
> /* Keywords Upper, 4 space indent, commas after, AND/OR after,
> * no spaces after ( or before ), or around ::
> */
> SELECT DISTINCT
> dep.deptype,
> dep.classid,
> coalesce(coc.relname, clrw.relname) AS ownertable
> FROM
> pg_depend dep
> LEFT JOIN pg_class cl ON dep.objid = cl.oid
> LEFT JOIN pg_attribute att ON dep.objid = att.attrelid AND
> dep.objsubid = att.attnum
> WHERE
> dep.objid = 16385::oid AND
> classid IN (
> SELECT
> oid
> FROM
> pg_class
> WHERE
> relname IN ('pg_class', 'pg_constraint')
> )
> ORDER BY
> classid,
> cl.relkind;
>
> There are some subtleties that are open to personal taste there;
>
> - Formatting of the sub-select - e.g. should the SELECT directly follow
> the (, and should the rest be indented accordingly?
>
> - Formatting of multiple quals in the joins; e.g. should the qual
> following the AND be on the next line, and if so, should it be indented one
> level, or to align with the qual above? Should the first qual be on the
> next line?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

Sorry I let this linger. Let's go with the style you currently have. With
respect to your additional comments.

- Sub-Select should be a new line and indented as in your example.
- For multiple quals in the joins; the qual following the AND should be on
the next line, and should it be indented one level

-- Rob

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Harshal Dhumal 2017-05-28 17:25:56 Re: pgAdmin 4 commit: Cleanup handling of default/null values when data edi
Previous Message Dave Page 2017-05-27 20:28:24 Re: [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid