Saturday, August 5, 2023

Case-insensitive non-deterministic collation

The following warning triggered a bit of research which looks like a significant amount of study will be required to find the collation needed ...


django.contrib.postgres.fields.CICharField is deprecated. Support for it (except in historical migrations) will be removed in Django 5.1.
        HINT: Use CharField(db_collation="…") with a case-insensitive non-deterministic collation instead.


Does anyone have experience they would like to share? What replaces that ellipsis?

The primary use case is to establish case-insensitivity when checking names - including usernames, company names and abbreviations/acronyms. Maybe there is a better way to handle that?

This is my typical PostgreSQL database spec ...

CREATE DATABASE xxxx
    WITH
    OWNER = miked
    ENCODING = 'UTF8'
    LC_COLLATE = 'C'
    LC_CTYPE = 'C'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1
    IS_TEMPLATE = False;

Many thanks for any help

Cheers

Mike

    

No comments:

Post a Comment