How to implement a case-insensitive exclusive constraint (for example, for usernames)? #6448
-
I want to store usernames in a user table but enforce that the usernames are unique in a case-insensitive way. When using Postgres directly, I used the citext extension to accomplish this (I set the username column's type to CITEXT and added a UNIQUE constraint to it). Until the citext extension is supported in EdgeDB, do you have any suggestions for the best way of accomplishing this? I could create a separate |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
https://www.edgedb.com/docs/stdlib/constraints#constraint::std::exclusive Is it possible to use something like |
Beta Was this translation helpful? Give feedback.
https://www.edgedb.com/docs/stdlib/constraints#constraint::std::exclusive
Is it possible to use something like
constraint exclusive on (str_lower(.username))
?