public inbox for [email protected]help / color / mirror / Atom feed
Re: Running psql in a docker container 4+ messages / 3 participants [nested] [flat]
* Re: Running psql in a docker container @ 2024-07-11 18:14 H <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: H @ 2024-07-11 18:14 UTC (permalink / raw) To: [email protected]; Adrian Klaver <[email protected]>; PostgreSQL Users Mailing List <[email protected]> On July 11, 2024 11:06:02 AM GMT-04:00, Adrian Klaver <[email protected]> wrote: >On 7/11/24 07:57, H wrote: >> I used to successfully run psql server 13 in a CentOS 7 docker >container with CentOS 7 as the host operating system. I have now >upgraded that system to Rocky Linux 9 as the host operating system and >modifying my container to also use Rocky Linux 9 and psql server 16. >> >> I can successfully get the container up and running and can connect >to it. However, I have not managed to modify the initdb statement to >use en_US.UTF-8 for all databases. >> >> In the old container I used: >> >> su - postgres -c "/usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data/ >-E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'" >> >> but this does not work with psql 16. I tried: >> >> su - postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data/ >-E 'UTF-8' --lc-lang='en_US'" >> >> and variations thereof with no success. > >Without a definition of what '... no success' means there is no real >way >to answer this. > >> >> Any suggestions on what I have missed? >> >> Thank you. >> >> Good question! ”No success” meant that I have not been able to figure out how to have new databases default to en_US.UTF-8, instead they default to C.UTF-8. What is the proper syntax for pgsql 16 for this? I could not get the example given in the docs to work... ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Running psql in a docker container @ 2024-07-11 18:24 David G. Johnston <[email protected]> parent: H <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: David G. Johnston @ 2024-07-11 18:24 UTC (permalink / raw) To: H <[email protected]>; +Cc: Adrian Klaver <[email protected]>; PostgreSQL Users Mailing List <[email protected]> On Thu, Jul 11, 2024 at 11:16 AM H <[email protected]> wrote: > What is the proper syntax for pgsql 16 for this? I could not get the > example given in the docs to work... > The documentation says this still works: su - postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data/ -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'" If it isn't for you please show the evidence of the non-working-ness. David J. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Running psql in a docker container @ 2024-07-11 19:31 Adrian Klaver <[email protected]> parent: H <[email protected]> 1 sibling, 1 reply; 4+ messages in thread From: Adrian Klaver @ 2024-07-11 19:31 UTC (permalink / raw) To: H <[email protected]>; [email protected] On 7/11/24 11:14, H wrote: > On July 11, 2024 11:06:02 AM GMT-04:00, Adrian Klaver <[email protected]> wrote: >> On 7/11/24 07:57, H wrote: >>> I used to successfully run psql server 13 in a CentOS 7 docker >> container with CentOS 7 as the host operating system. I have now >> upgraded that system to Rocky Linux 9 as the host operating system and >> modifying my container to also use Rocky Linux 9 and psql server 16. >>> >>> I can successfully get the container up and running and can connect >> to it. However, I have not managed to modify the initdb statement to >> use en_US.UTF-8 for all databases. >>> >>> In the old container I used: >>> >>> su - postgres -c "/usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data/ >> -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'" >>> >>> but this does not work with psql 16. I tried: >>> >>> su - postgres -c "/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data/ >> -E 'UTF-8' --lc-lang='en_US'" 1) Per: https://www.postgresql.org/docs/16/app-initdb.html lc_lang does not exist and I get: /usr/lib/postgresql/16/bin/initdb: unrecognized option '--lc-lang=en_US' 2) On Ubuntu 22.04 doing: /usr/lib/postgresql/16/bin/initdb -D postgres/16/data/ -E 'UTF-8' --lc-collate='en_US.utf8' --lc-ctype='en_US.utf8' I get: postgres=# \l List of databases -[ RECORD 1 ]-----+-------------------- Name | postgres Owner | aklaver Encoding | UTF8 Locale Provider | libc Collate | en_US.utf8 Ctype | en_US.utf8 ICU Locale | ICU Rules | Access privileges | -[ RECORD 2 ]-----+-------------------- Name | template0 Owner | aklaver Encoding | UTF8 Locale Provider | libc Collate | en_US.utf8 Ctype | en_US.utf8 ICU Locale | ICU Rules | Access privileges | =c/aklaver + | aklaver=CTc/aklaver -[ RECORD 3 ]-----+-------------------- Name | template1 Owner | aklaver Encoding | UTF8 Locale Provider | libc Collate | en_US.utf8 Ctype | en_US.utf8 ICU Locale | ICU Rules | Access privileges | =c/aklaver + | aklaver=CTc/aklaver 3) What does locale -a return on your machine? >>> >>> and variations thereof with no success. >> >> Without a definition of what '... no success' means there is no real >> way >> to answer this. >> >>> >>> Any suggestions on what I have missed? >>> >>> Thank you. >>> >>> > > Good question! ”No success” meant that I have not been able to figure out how to have new databases default to en_US.UTF-8, instead they default to C.UTF-8. > > What is the proper syntax for pgsql 16 for this? I could not get the example given in the docs to work... -- Adrian Klaver [email protected] ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Running psql in a docker container @ 2024-07-11 20:28 H <[email protected]> parent: Adrian Klaver <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: H @ 2024-07-11 20:28 UTC (permalink / raw) To: [email protected]; Adrian Klaver <[email protected]> On July 11, 2024 3:31:37 PM EDT, Adrian Klaver <[email protected]> wrote: >On 7/11/24 11:14, H wrote: >> On July 11, 2024 11:06:02 AM GMT-04:00, Adrian Klaver ><[email protected]> wrote: >>> On 7/11/24 07:57, H wrote: >>>> I used to successfully run psql server 13 in a CentOS 7 docker >>> container with CentOS 7 as the host operating system. I have now >>> upgraded that system to Rocky Linux 9 as the host operating system >and >>> modifying my container to also use Rocky Linux 9 and psql server 16. >>>> >>>> I can successfully get the container up and running and can connect >>> to it. However, I have not managed to modify the initdb statement to >>> use en_US.UTF-8 for all databases. >>>> >>>> In the old container I used: >>>> >>>> su - postgres -c "/usr/pgsql-13/bin/initdb -D >/var/lib/pgsql/13/data/ >>> -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'" >>>> >>>> but this does not work with psql 16. I tried: >>>> >>>> su - postgres -c "/usr/pgsql-16/bin/initdb -D >/var/lib/pgsql/16/data/ >>> -E 'UTF-8' --lc-lang='en_US'" > >1) Per: > >https://www.postgresql.org/docs/16/app-initdb.html > >lc_lang does not exist and I get: > >/usr/lib/postgresql/16/bin/initdb: unrecognized option >'--lc-lang=en_US' > >2) On Ubuntu 22.04 doing: > > /usr/lib/postgresql/16/bin/initdb -D postgres/16/data/ -E 'UTF-8' >--lc-collate='en_US.utf8' --lc-ctype='en_US.utf8' > >I get: > >postgres=# \l >List of databases >-[ RECORD 1 ]-----+-------------------- >Name | postgres >Owner | aklaver >Encoding | UTF8 >Locale Provider | libc >Collate | en_US.utf8 >Ctype | en_US.utf8 >ICU Locale | >ICU Rules | >Access privileges | >-[ RECORD 2 ]-----+-------------------- >Name | template0 >Owner | aklaver >Encoding | UTF8 >Locale Provider | libc >Collate | en_US.utf8 >Ctype | en_US.utf8 >ICU Locale | >ICU Rules | >Access privileges | =c/aklaver + > | aklaver=CTc/aklaver >-[ RECORD 3 ]-----+-------------------- >Name | template1 >Owner | aklaver >Encoding | UTF8 >Locale Provider | libc >Collate | en_US.utf8 >Ctype | en_US.utf8 >ICU Locale | >ICU Rules | >Access privileges | =c/aklaver + > | aklaver=CTc/aklaver > >3) What does locale -a return on your machine? > > >>>> >>>> and variations thereof with no success. >>> >>> Without a definition of what '... no success' means there is no real >>> way >>> to answer this. >>> >>>> >>>> Any suggestions on what I have missed? >>>> >>>> Thank you. >>>> >>>> >> >> Good question! ”No success” meant that I have not been able to figure >out how to have new databases default to en_US.UTF-8, instead they >default to C.UTF-8. >> >> What is the proper syntax for pgsql 16 for this? I could not get the >example given in the docs to work... You are right, the locale is now called en_US.utf8 and with that correction I get the expected result. ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-07-11 20:28 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-07-11 18:14 Re: Running psql in a docker container H <[email protected]> 2024-07-11 18:24 ` David G. Johnston <[email protected]> 2024-07-11 19:31 ` Adrian Klaver <[email protected]> 2024-07-11 20:28 ` H <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox