--locale options not honoured?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

--locale options not honoured?

byrnejb
FreeBSD 12.2-RELEASE-p3
postgresql13-server-13.1_1

I am try to create a new pg database with --locale=en_US.UTF8.  However initdb
does not seem to actually carry out the instructions.  I have tried this with
and without the --lc-collate and lc-ctype options. The result is the same.

sudo -u postgres initdb --locale=en_US.UTF-8 --lc-collate=en_US.UTF-8
--lc-ctype=en_US.UTF-8 -D /var/db/postgres/data13
could not change directory to "/root": Permission denied
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /var/db/postgres/data13 ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Canada/Eastern
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

psql -U postgres template1
psql (13.1)
Type "help" for help.

template1=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
(3 rows)

On another (9.6) host I see this:

template1=# \l
                                             List of databases
        Name         |         Owner         | Encoding |   Collate   |  
Ctype    |   Access privileges
---------------------+-----------------------+----------+-------------+-------------+-----------------------

  postgres            | postgres             | UTF8     | en_US.UTF-8 |
en_US.UTF-8 |
  template0           | postgres             | UTF8     | en_US.UTF-8 |
en_US.UTF-8 | =c/postgres          +
                     |                       |          |             |        
    | postgres=CTc/postgres
 template1           | postgres              | UTF8     | en_US.UTF-8 |
en_US.UTF-8 | postgres=CTc/postgres+
                     |                       |          |             |        
    | =c/postgres


Why are not the collating sequence and Ctype set to UTF-8?  How do I get the
locale specified completely?



--
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
   Unencrypted messages have no legal claim to privacy
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:[hidden email]
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3



Reply | Threaded
Open this post in threaded view
|

Re: --locale options not honoured?

David G Johnston
On Fri, Feb 19, 2021 at 11:22 AM James B. Byrne <[hidden email]> wrote:
I am try to create a new pg database with --locale=en_US.UTF8.

You are creating a whole new cluster., not just a database.

  However initdb
does not seem to actually carry out the instructions.  I have tried this with
and without the --lc-collate and lc-ctype options. The result is the same.

sudo -u postgres initdb --locale=en_US.UTF-8 --lc-collate=en_US.UTF-8
--lc-ctype=en_US.UTF-8 -D /var/db/postgres/data13


psql -U postgres template1
psql (13.1)
Type "help" for help.

template1=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
(3 rows)


You created a new cluster, but never started it, yet were able to connect to it without a problem.  I suspect you are connecting psql to some already running existing cluster and that the cluster you initdb'd is correctly configured but just sitting there offline waiting to be started - possibly after changing its port information so it doesn't conflict with this already running instance.

David J.
Reply | Threaded
Open this post in threaded view
|

Re: --locale options not honoured?

byrnejb


On Fri, February 19, 2021 13:30, David G. Johnston wrote:
> On Fri, Feb 19, 2021 at 11:22 AM James B. Byrne <[hidden email]>
> wrote:
>
>> I am try to create a new pg database with --locale=en_US.UTF8.
>
>
> You are creating a whole new cluster., not just a database.
>
. . .
> You created a new cluster, but never started it, yet were able to connect
> to it without a problem.  I suspect you are connecting psql to some already
> running existing cluster and that the cluster you initdb'd is correctly
> configured but just sitting there offline waiting to be started - possibly
> after changing its port information so it doesn't conflict with this
> already running instance.
>

I do not know how I did that but, evidently I did.  Thank you.

psql -U postgres template1
psql (13.1)
Type "help" for help.

template1=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres    
    +
           |          |          |             |             |
postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres    
    +
           |          |          |             |             |
postgres=CTc/postgres
(3 rows)


--
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
   Unencrypted messages have no legal claim to privacy
 Do NOT open attachments nor follow links sent by e-Mail

James B. Byrne                mailto:[hidden email]
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3