-
Notifications
You must be signed in to change notification settings - Fork 1.2k
How to configure Dokerfile for available swedish collate ? #725
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
Comments
imho: the official way for the 'Locale Customization' https://hub.docker.com/_/postgres original FROM postgres:9.4
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
ENV LANG de_DE.utf8 |
@ImreSamu but you told about localization. When I set LANG to
whoud be great if could be LANG set english but default collate set in swedish.. Or first my goal set collate for separate column in swedish example ... or set collate
but still faced with error |
@shubaivan with this Dockerfile the FROM postgres:9.6
RUN localedef -i sv_SE -c -f UTF-8 -A /usr/share/locale/locale.alias sv_SE.UTF-8
ENV LANG sv_SE.utf8 $ docker run --rm -it --link pg_sv:postgres \
> postgres96_sv \
> sh -c 'PGPASSWORD=mysecretpw exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres '
psql (9.6.17)
Skriv "help" för hjälp.
postgres=# CREATE table hello as
postgres-# select 'hej världen'::text as m
postgres-# union all select 'hello world'::text as m
postgres-# ;
SELECT 2
postgres=# SELECT * FROM hello ORDER BY m COLLATE "sv_SE";
m
-------------
hej världen
hello world
(2 rader)
postgres=# SELECT * FROM pg_collation;
collname | collnamespace | collowner | collencoding | collcollate | collctype
------------+---------------+-----------+--------------+-------------+------------
default | 11 | 10 | -1 | |
C | 11 | 10 | -1 | C | C
POSIX | 11 | 10 | -1 | POSIX | POSIX
C.UTF-8 | 11 | 10 | 6 | C.UTF-8 | C.UTF-8
en_US | 11 | 10 | 6 | en_US.utf8 | en_US.utf8
en_US.utf8 | 11 | 10 | 6 | en_US.utf8 | en_US.utf8
sv_SE | 11 | 10 | 6 | sv_SE.utf8 | sv_SE.utf8
sv_SE.utf8 | 11 | 10 | 6 | sv_SE.utf8 | sv_SE.utf8
ucs_basic | 11 | 10 | 6 | C | C
(9 rader) my test commands:
|
|
imho: probably your volumes ( |
I have a working example of setting Modified for Swedish FROM postgres
RUN sed -i -e 's/# sv_SE.UTF-8 UTF-8/sv_SE.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG sv_SE.UTF-8
ENV LANGUAGE sv_SE:sv
ENV LC_ALL sv_SE.UTF-8 postgres=# SELECT * FROM pg_collation;
oid | collname | collnamespace | collowner | collprovider | collisdeterministic | collencoding | collcollate | collctype | collversion
-------+------------------------+---------------+-----------+--------------+---------------------+--------------+------------------+------------------+-------------
100 | default | 11 | 10 | d | t | -1 | | |
950 | C | 11 | 10 | c | t | -1 | C | C |
951 | POSIX | 11 | 10 | c | t | -1 | POSIX | POSIX |
12326 | ucs_basic | 11 | 10 | c | t | 6 | C | C |
12327 | C.UTF-8 | 11 | 10 | c | t | 6 | C.UTF-8 | C.UTF-8 |
12328 | sv_SE.utf8 | 11 | 10 | c | t | 6 | sv_SE.utf8 | sv_SE.utf8 |
12329 | sv_SE | 11 | 10 | c | t | 6 | sv_SE.utf8 | sv_SE.utf8 |
12330 | und-x-icu | 11 | 10 | i | t | -1 | und | und | 153.88
12331 | af-x-icu | 11 | 10 | i | t | -1 | af | af | 153.88.34
12332 | af-NA-x-icu | 11 | 10 | i | t | -1 | af-NA | af-NA | 153.88.34
12333 | af-ZA-x-icu | 11 | 10 | i | t | -1 | af-ZA | af-ZA | 153.88.34
12334 | agq-x-icu | 11 | 10 | i | t | -1 | agq | agq | 153.88
12335 | agq-CM-x-icu | 11 | 10 | i | t | -1 | agq-CM | agq-CM | 153.88
12336 | ak-x-icu | 11 | 10 | i | t | -1 | ak | ak | 153.88
12337 | ak-GH-x-icu | 11 | 10 | i | t | -1 | ak-GH | ak-GH | 153.88
12338 | am-x-icu | 11 | 10 | i | t | -1 | am | am | 153.88.34
12339 | am-ET-x-icu | 11 | 10 | i | t | -1 | am-ET | am-ET | 153.88.34
12340 | ar-x-icu | 11 | 10 | i | t | -1 | ar | ar | 153.88.34
12341 | ar-001-x-icu | 11 | 10 | i | t | -1 | ar-001 | ar-001 | 153.88.34
12342 | ar-AE-x-icu | 11 | 10 | i | t | -1 | ar-AE | ar-AE | 153.88.34
12343 | ar-BH-x-icu | 11 | 10 | i | t | -1 | ar-BH | ar-BH | 153.88.34
12344 | ar-DJ-x-icu | 11 | 10 | i | t | -1 | ar-DJ | ar-DJ | 153.88.34
12345 | ar-DZ-x-icu | 11 | 10 | i | t | -1 | ar-DZ | ar-DZ | 153.88.34
12346 | ar-EG-x-icu | 11 | 10 | i | t | -1 | ar-EG | ar-EG | 153.88.34
12347 | ar-EH-x-icu | 11 | 10 | i | t | -1 | ar-EH | ar-EH | 153.88.34
12348 | ar-ER-x-icu | 11 | 10 | i | t | -1 | ar-ER | ar-ER | 153.88.34
12349 | ar-IL-x-icu | 11 | 10 | i | t | -1 | ar-IL | ar-IL | 153.88.34
12350 | ar-IQ-x-icu | 11 | 10 | i | t | -1 | ar-IQ | ar-IQ | 153.88.34
12351 | ar-JO-x-icu | 11 | 10 | i | t | -1 | ar-JO | ar-JO | 153.88.34
12352 | ar-KM-x-icu | 11 | 10 | i | t | -1 | ar-KM | ar-KM | 153.88.34
12353 | ar-KW-x-icu | 11 | 10 | i | t | -1 | ar-KW | ar-KW | 153.88.34
12354 | ar-LB-x-icu | 11 | 10 | i | t | -1 | ar-LB | ar-LB | 153.88.34
12355 | ar-LY-x-icu | 11 | 10 | i | t | -1 | ar-LY | ar-LY | 153.88.34
12356 | ar-MA-x-icu | 11 | 10 | i | t | -1 | ar-MA | ar-MA | 153.88.34
12357 | ar-MR-x-icu | 11 | 10 | i | t | -1 | ar-MR | ar-MR | 153.88.34 |
After I removed and created again
But one thing, how to use convert like in mysql for convert data from |
For upgrading to newer postgres versions Tianon has a repo with upgrade-containers to invoke pg_upgrade
You could also try asking over at the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since these repos aren't really a user-help forum |
Uh oh!
There was an error while loading. Please reload this page.
I use docker image for postgres. And after some time I needed change default collate or collate for some column, whould be great convert data to new collate, but I faced witth some problem for set another collate to column. My image
I want to set swedish collate to my column
category_name
incategory
table, For that I just try to execute this queryafter that I executed manually in my container
Locales to be generated: 1
and choice 1 and after loading all locales I saw
but after that still faced with the same error
when I check
pg_collation
I did not found my sv_SE.UTF-8how to set swedish collate for my column ?
UPDATE
after manually executed in postgres container
locale-gen sv_SE.utf8 && dpkg-reconfigure
have that result:I try to create new database but faced with the same error... what wrong ??
maybe need reload service or something like that for apply changes?
maybe need reload service or something like that for apply changes?
The text was updated successfully, but these errors were encountered: