4 ms·
I think postgreSQL's 'citext' datatype gets around this: > The citext data type allows you to eliminate calls to lower in SQL queries, and allows a primary key
by nomilk 5y ago
I think postgreSQL's 'citext' datatype gets around this:
> The citext data type allows you to eliminate calls to lower in SQL queries, and allows a primary key to be case-insensitive.
https://www.postgresql.org/docs/9.0/citext.html https://www.postgresql.org/docs/9.0/citext.html
TL;DR If users choose their usernames, and 'MyUserName' was registered and someone tried to register 'myusername', it would detect a collision and error, thus not causing any problems (the second user would simply have to choose another username).
- IiydAbITMvJkqKf 5y agoUUIDs are not text. Most uuid parsers ignore hyphens and braces, so citext will not help you. Use the native uuid type, or as a fallback, store it in a 16 byte binary blob.
- dtech 5y agoNote that most of the examples are UUIDs, and postgres has a datatype for that that evades all these problems and is a lot more efficient too.