简体   繁体   中英

AWS Aurora Postgres 12 Setting Collation

I am trying to set the collation on AWS Aurora Postgres 12 to a user defined collation type.

CREATE COLLATION ndcoll (provider = icu, locale = 'und', deterministic = false);

I am able to create the collation just fine. It ends up being entered into the pg_collations table.

However, when I go to try to create a database using this new user defined collation, I keep receiving the error SQL Error [42809]: ERROR: invalid locale name: "ndcoll"

This is the create database statement:

create database "foo" with template 'bar' lc_collate = "ndcoll";

I know there is also a way to set the collation at the server level using a custom parameter group. But the parameter group family I am using aurora-postgres 12 does not have a parameter available to set the collation. After creating my user defined collation, I restarted the Aurora server, but still cannot get the DB to recognize the locale. I might be not understanding locale and lc_collate as well. Maybe there is a misunderstanding on my end fundamentally.

Does anyone have any insight as to how I can use my user defined collation either 1) to create new databases using this user defined collation or 2) set the collation at the server level to a non-deterministic collation in the aurora-postgres12 parameter group family.

Thanks in advance!

You cannot use ICU collations in a CREATE DATABASE statement.

That restriction may be lifted in some future PostgreSQL release. For now, the only way to have non-deterministic collations in PostgreSQL is to use them at the column level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM