Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
nixos/postgresql: support 0750 for data directory #65245
This is rework of part of #46670.
PG11 now allows starting server with 0750 mask for data dir.
For PG10 and below, I've described a hack how this can be done. Before this PR
Test/example is present too.
This is rework of part of #46670. My usecase was to be able to inspect PG datadir as wheel user. PG11 now allows starting server with 0750 mask for data dir. `groupAccess = true` now does this automatically. The only thing you have to do is to set group ownership. For PG10 and below, I've described a hack how this can be done. Before this PR hack was impossible. The hack isn't ideal, because there is short period of time when dir mode is 0700, so I didn't want to make it official. Test/example is present too.
I've rethought my approach. Let's not support pre11 versions THAT much. It is enough to just ensure state dir has 0700 mode for old PG.
So now dir mode is enforced only when PG is older than 11. This fixes a nasty issue when you add tmpfiles rule to make PG group-accessible and suddenly on next reboot PG doesn't start (yes, I had this...).
Now all 3 examples below start postgres, and last are possible ways to set group mode.