Skip to content

incorrect ctype and collation in database #198

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

Closed
UlrichKnaack opened this issue May 28, 2020 · 3 comments
Closed

incorrect ctype and collation in database #198

UlrichKnaack opened this issue May 28, 2020 · 3 comments

Comments

@UlrichKnaack
Copy link

I've tried to apply german character encoding in my database, but I got C.UTF-8.
This is my setup:

version: "3"

services:
    pgis:
        image: postgis/postgis:12-3.0
        container_name: pgis
        volumes:
            - pgisdb:/var/lib/postgresql/data/
            - ./init/:/docker-entrypoint-initdb.d/
            # - ./init/sql/:/docker-entrypoint-initdb.d/sql/
        ports:
            - "5432:5432"
        restart: always
        env_file: env-pgis

    pgadmin4:
        image: dpage/pgadmin4:4.21
        volumes:
            - pgadmin4:/pgadmin4
            - pgadmin4lib:/var/lib/pgadmin
        ports:
            - "8085:80"
        env_file: env-pgadmin

volumes:
    pgisdb:
    pgadmin4:
    pgadmin4lib:
    init:

env-pgis:

POSTGRES_USER=bop
POSTGRES_PASSWORD=mypass
POSTGRES_DBNAME=pgis
DEFAULT_COLLATION=de_DE.UTF-8
DEFAULT_CTYPE=de_DE.UTF-8
DEFAULT_ENCODIG=UTF8

Output (extract) from docker-compose logs:

pgis        | The database cluster will be initialized with locale "en_US.utf8".
pgis        | The default database encoding has accordingly been set to "UTF8".
pgis        | The default text search configuration will be set to "english".
@UlrichKnaack UlrichKnaack changed the title incorrect type ans collation in database incorrect ctype and collation in database May 28, 2020
@ImreSamu
Copy link
Member

ImreSamu commented May 28, 2020

imho:

see https://hub.docker.com/_/postgres "Locale Customization" part.
just replace the FROM part to postgis/postgis:12-3.0 and build a new docker image - for yourself ..

FROM postgis/postgis:12-3.0
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
ENV LANG de_DE.utf8

and don't forget ... it is only working for empty postgresql data .... ( in your spec: - pgisdb:/var/lib/postgresql/data/ )
https://www.postgresql.org/docs/12/locale.html#id-1.6.10.3.4 "Locale support is automatically initialized when a database cluster is created .... "

@ImreSamu
Copy link
Member

@UlrichKnaack
Copy link
Author

thank you, now it works as expected.

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