AWS RDS:为PostgreSQL指定lc_collate和lc_ctype

3
我正在尝试使用CloudFormation在RDS上创建PostgreSQL数据库。它说所有支持的参数都在CreateDBInstance中描述。到目前为止,我无法找到任何可以影响LC_COLLATELC_CTYPE的参数,无论是通过DB参数组还是其他方式。这些需要在数据库创建期间指定,不能在之后更改。
目前,这两个值将始终设置为en_US.UTF-8
1个回答

2
您可以创建指定这些的数据库,例如:
t=# create database c LC_COLLATE 'C' LC_CTYPE 'C' template template0;
CREATE DATABASE
t=# \l+
                                                                    List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   |  Size   | Tablespace |                Description
-----------+----------+----------+-------------+-------------+-----------------------+---------+------------+--------------------------------------------
 c         | postgres | UTF8     | C           | C           |                       | 7601 kB | pg_default |
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 8157 kB | pg_default | default administrative connection database
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +| 7601 kB | pg_default | unmodifiable empty database
           |          |          |             |             | postgres=CTc/postgres |         |            |
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +| 7733 kB | pg_default | default template for new databases
           |          |          |             |             | postgres=CTc/postgres |         |            |
(4 rows)

我本来希望默认创建的数据库能够具有正确的配置,但看起来最好的解决方案是编写一个初始化脚本来删除并重新创建它。 - Marcus Ilgner

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接