Doc: how to guarentee case insensitive uniqueness for a string #5382
Labels
C-doc-improvement
no-issue-activity
O-external
Origin: Issue comes from external users.
O-support
Internal source: Support
P-3
Low priority; nice-to-have
T-missing-info
Matthew Vardi (mattcrdb) commented:
A customer brought up an issue when migrating over to CRDB.
How can he guarantee that an email string column prevents case insensitive duplicates.
One solution is to create a computed column using the lower() function and then applying the unique constraint using alter table.
I have confirmed this works as intended, however, might not be the best solution at scale.
Another solution suggested by @justinj is to use collate. I have not looked into how this works.
Postgres has a citext data type that allows for this functionality, from their documentation:
The citext module provides a case-insensitive character string type, citext. Essentially, it internally calls lower when comparing values. Otherwise, it behaves almost exactly like text.
Jira Issue: DOC-321
The text was updated successfully, but these errors were encountered: