Fix permission issue on postgresql15 or later #176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PostgreSQL 15 or later removed PUBLIC creation permission on the public schema. As
sameersbn/postgresql
does not have a way to set database owner, user can face permission issue. See https://www.postgresql.org/docs/15/release-15.htmlThis PR ports following fixes from my fork kkimurak/sameersbn-postgresql.
Add parameter
DB_USER_IS_DB_OWNER
. If it is set to true,DB_USER
will become an owner of database listed inDB_NAME
. This can be direct fix of the issue.note: This change is ported from Add parameter
DB_USER_IS_DB_OWNER
(boolean) kkimurak/docker-postgresql#10, included in releases 20250717 and later and is available for testing.Grant ALL privileges on the public schema to
DB_USER
ifDB_USER_IS_DB_OWNER
is not set to true.This was introduced as a temporary workaround based on the error message displayed in discussion to update sameersbn/gitlab to 18.0.0 (See Upgrade GitLab CE to 18.0.0 docker-gitlab#3107 (comment)).
It was later confirmed in the official documentation that the owner of the database itself was changed, and this workaround may not be correct (although it works). Therefore, I will revert this change if requested.
note: This change isported from GRANT ALL ON SCHEMA public TO ${DB_USER} kkimurak/docker-postgresql#1 and fix: specify database to GRANT ALL ON SCHEMA public TO ${DB_USER} kkimurak/docker-postgresql#5, included in release 20250518 or later and is available for testing.