Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to skip DB init check #1220

Open
xtexChooser opened this issue Mar 31, 2024 · 2 comments
Open

Add an option to skip DB init check #1220

xtexChooser opened this issue Mar 31, 2024 · 2 comments

Comments

@xtexChooser
Copy link

https://github.com/docker-library/postgres/blob/master/16/alpine3.19/docker-entrypoint.sh#L234

Currently, checking if the DB is initialized is by checking if $PGDATA/PG_VERSION if exist.
However, PGDATA may not be the real data directory.
The real data directory can be overwritten by $PGDATA/postgresql.conf with data_directory = ''.

@tianon
Copy link
Member

tianon commented Apr 1, 2024

IMO that sounds like an argument for asking PostgreSQL to give us the value of data_directory, not an argument for skipping the check 😅

https://www.postgresql.org/docs/8.0/runtime-config.html#:~:text=If%20you%20wish%20to,of%20the%20configuration%20files is a really interesting/useful reference 👀

@xtexChooser
Copy link
Author

xtexChooser commented Apr 3, 2024

How about getting data_directory, when postgresql.conf exists, through:

  -C NAME            print value of run-time parameter, then exit
/ # echo $PGDATA
/var/lib/postgresql
/ # cat /var/lib/postgresql/postgresql.conf | grep data_directory
data_directory = '/var/lib/postgresql/data'
/ # postgres -C data_directory
/var/lib/postgresql/data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants