kartoza / docker-postgis

Dockerfile for postgis
GNU General Public License v2.0
660 stars 313 forks source link

Misleading Error Message for User Creation with Mixed Case in kartoza/postgis:16-3.4 Docker Container #463

Closed spechtx closed 8 months ago

spechtx commented 1 year ago

What is the bug or the crash?

Description I am encountering a error message when attempting to create a PostgreSQL user with "appdb_ADMIN", in the kartoza/postgis:16-3.4 Docker container. I am aware of PostgreSQL to automatically converting unquoted identifiers to lowercase, that is why i am especially using it in quotes.

Steps to reproduce the issue

  1. Set "appdb_ADMIN" as the POSTGRES_USER
  2. Run the kartoza/postgis:16-3.4 Docker container.
  3. Observe the error message indicating that a role appdb_admin already exists, which is confusing since the attempt was to create appdb_ADMIN.
postgres@postgres ERROR:  role "appdb_admin" already exists
postgres@postgres STATEMENT:  CREATE USER appdb_ADMIN WITH SUPERUSER ENCRYPTED PASSWORD 'xxxx';
ERROR:  role "appdb_admin" already exists

Versions

kartoza/postgis:16-3.4 Docker 24.0.7, build afdd53b Portainer CE 2.19.2 host: Debian 6.1.55-1 x86_64

Additional context

version: '3.9'

services:
  db:
    image: kartoza/postgis:16-3.4
    container_name: pg-appdb
    volumes:
      - pg-appdb:/var/lib/postgresql
    environment:
      # If you need to create multiple database you can add coma separated databases eg gis,data
      - POSTGRES_DB=gis
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASS=${POSTGRES_PASS}
      - POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology,postgis_raster,pgrouting
      - RUN_AS_ROOT=true

    ports:
      - "5432:5432"
    restart: on-failure
    healthcheck:
      test: "PGPASSWORD=${POSTGRES_PASS} pg_isready -h 127.0.0.1 -U ${POSTGRES_USER} -d gis"

volumes:
  pg-appdb:
NyakudyaA commented 8 months ago

@spechtx Can you take a look at the PR if you still interested in this fix