Andrew0Hill / NURS6293_environment

Docker-based environment to provide desktop interface and database access for NURS 6293.
0 stars 0 forks source link

Postgres initdb error: "Current user cannot be dropped" #19

Closed mgkahn closed 1 month ago

mgkahn commented 2 months ago

Error with executing nurs6293_createdb.sql.gz in initdb context. See error log screenshot. Error not seen in psql testing environment.

initdb_error

mgkahn commented 2 months ago

Fix implemented in new initdb_fix branch.

Issue caused by a difference in Postgres initialization between development and production Docker images. Development image does not call initdb before executing scripts in /docker-entrypoint-initdb.d Production docker PG image calls initdb and then calls scripts in /docker-entrypoint-initdb.d. The call to initdb creates the postgres superuser. See attached screen shot from dockerhub Postgres overview: https://hub.docker.com/_/postgres

image

Implemented hack from https://serverfault.com/questions/857339/backing-up-restoring-postgres-using-pg-dumpall-split-gzip-set-on-error

@Andrew0Hill : New nurs6293_database/Scripts/nurs6293_createdb.sql.gz only in initdb_fix branch for testing prior to merging into main.

Andrew0Hill commented 1 month ago

Fixed and merged, thanks! Closing this issue.