Thread

Commits

  1. Check for tabs in postgresql.conf.sample.

  2. Switch from tabs to spaces in postgresql.conf.sample.

  3. Update .editorconfig and .gitattributes for postgresql.conf.sample.

  1. postgresql.conf.sample tab width

    Nathan Bossart <nathandbossart@gmail.com> — 2025-11-14T20:13:04Z

    I noticed that GitHub is using 4-space tabs for this file [0], presumably
    due to this [1] recent change.  I'm not aware of an official policy for
    this file, but it seems to be written for 8-space tabs.
    
    One way to fix this is to set our default tab width to 8 in
    .gitattributes/.editorconfig (see attached patch).  AFAICT that doesn't
    affect source code files.  We could also add a special rule for
    postgresql.conf.sample, or we could even convert it to 4-space tabs.  Any
    druthers?
    
    [0] https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
    [1] https://github.blog/changelog/2025-08-07-default-tab-size-changed-from-eight-to-four/
    
    -- 
    nathan
    
  2. Re: postgresql.conf.sample tab width

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-14T20:25:15Z

    Nathan Bossart <nathandbossart@gmail.com> writes:
    > I noticed that GitHub is using 4-space tabs for this file [0], presumably
    > due to this [1] recent change.  I'm not aware of an official policy for
    > this file, but it seems to be written for 8-space tabs.
    
    > One way to fix this is to set our default tab width to 8 in
    > .gitattributes/.editorconfig (see attached patch).  AFAICT that doesn't
    > affect source code files.  We could also add a special rule for
    > postgresql.conf.sample, or we could even convert it to 4-space tabs.  Any
    > druthers?
    
    We've been around on this topic before.  It's hard for us to deal with
    8-space tabs within our repo, but we should expect that users who are
    editing their postgresql.conf files are probably going to be using
    8-space tabs.
    
    I seem to recall a proposal that the best fix is to not use tabs
    at all in postgresql.conf.sample.  That seems like a good way out
    to me.  I think we could fix .gitattributes so that "git diff --check"
    would verify no tabs, but I've not looked into details.
    
    			regards, tom lane
    
    
    
    
  3. Re: postgresql.conf.sample tab width

    Nathan Bossart <nathandbossart@gmail.com> — 2025-11-14T21:30:07Z

    On Fri, Nov 14, 2025 at 03:25:15PM -0500, Tom Lane wrote:
    > I seem to recall a proposal that the best fix is to not use tabs
    > at all in postgresql.conf.sample.  That seems like a good way out
    > to me.  I think we could fix .gitattributes so that "git diff --check"
    > would verify no tabs, but I've not looked into details.
    
    I don't see a way in .gitattributes to check for _any_ tabs in a file, just
    for beginning-of-line indentation with tabs.  But it's easy enough to add a
    check in the TAP test.
    
    -- 
    nathan
    
  4. Re: postgresql.conf.sample tab width

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-14T21:34:08Z

    Nathan Bossart <nathandbossart@gmail.com> writes:
    > I don't see a way in .gitattributes to check for _any_ tabs in a file, just
    > for beginning-of-line indentation with tabs.  But it's easy enough to add a
    > check in the TAP test.
    
    Works for me.  Do we need any special .gitattributes for the file
    at all, if we're relying on the TAP test to catch this?
    
    			regards, tom lane
    
    
    
    
  5. Re: postgresql.conf.sample tab width

    Nathan Bossart <nathandbossart@gmail.com> — 2025-11-14T21:38:01Z

    On Fri, Nov 14, 2025 at 04:34:08PM -0500, Tom Lane wrote:
    > Works for me.  Do we need any special .gitattributes for the file
    > at all, if we're relying on the TAP test to catch this?
    
    We'd at least need -whitespace (I think), but I figured we might as well
    highlight beginning-of-line tabs and trailing whitespace in diffs, too.
    The TAP test wouldn't catch the latter.
    
    -- 
    nathan
    
    
    
    
  6. Re: postgresql.conf.sample tab width

    Nathan Bossart <nathandbossart@gmail.com> — 2025-11-17T18:50:42Z

    Here is a rebased patch set.  Notably, I've split it into three pieces.
    I'm planning to add 0002 to .git-blame-ignore-revs, as testing indicates
    this preserves the blame history reasonably well.
    
    -- 
    nathan
    
  7. Re: postgresql.conf.sample tab width

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-17T19:08:32Z

    Nathan Bossart <nathandbossart@gmail.com> writes:
    > Here is a rebased patch set.  Notably, I've split it into three pieces.
    > I'm planning to add 0002 to .git-blame-ignore-revs, as testing indicates
    > this preserves the blame history reasonably well.
    
    Good idea.
    
    			regards, tom lane
    
    
    
    
  8. Re: postgresql.conf.sample tab width

    Chao Li <li.evan.chao@gmail.com> — 2025-11-18T02:25:38Z

    Hi Nathan,
    
    I just reviewed the patch. Looks to me the correct three-commit split:
    
    0001 updates tooling/configure so that 0002 will not introduce formatting violation
    0002 makes large formatting rewrite (tab->white spaces), and so that the commit needs to be added to .git-blace-ignore-revs 
    0003 adds CI enforcement so that no future patches to reintroduce tabs
    
    A tiny comment about a typo in 0003’s commit message:
    ```
    The previous commit updated this file to use tabs instead of
    spaces. 
    ```
    
    Should be “use spaces instead of tabs”.
    
    > On Nov 18, 2025, at 02:50, Nathan Bossart <nathandbossart@gmail.com> wrote:
    > 
    > Here is a rebased patch set.  Notably, I've split it into three pieces.
    > I'm planning to add 0002 to .git-blame-ignore-revs, as testing indicates
    > this preserves the blame history reasonably well.
    > 
    > -- 
    > nathan
    > <v3-0001-Update-.editorconfig-and-.gitattributes-for-postg.patch><v3-0002-Switch-from-tabs-to-spaces-in-postgresql.conf.sam.patch><v3-0003-Check-for-tabs-in-postgresql.conf.sample.patch>
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/
    
    
    
    
    
    
    
    
  9. Re: postgresql.conf.sample tab width

    Nathan Bossart <nathandbossart@gmail.com> — 2025-11-18T16:33:57Z

    On Tue, Nov 18, 2025 at 10:25:38AM +0800, Chao Li wrote:
    > I just reviewed the patch. Looks to me the correct three-commit split:
    
    Committed, thanks for reviewing.
    
    -- 
    nathan