Closed ruudk closed 3 years ago
Sorry but I don't see how this is related to downcasing. Even if we downcased it in the app, the database will handle collation differently, which means you will still have a difference in behaviour.
For PostgreSQL I don't really understand why a citext extension is installed for this purpose. If you go through all this trouble, why not simply do in the app?
Because it is much easier to do it at the database level. It is two lines of code. If you do it in the app, you need to downcase when you insert, when you run queries, etc... probably by implementing a custom type.
Oh, and thank you for the nice words and the discussion! :heart:
Closing this as it has stalled.
First of all, thanks for this amazing generator. Great work 🙌
I was wondering why the case sensitiveness is handed off to the database layer instead of handling this in the application. In my opinion it would be better to always lowercase the username (email) before persisting it in the database. The same should be done every time the database is queried. First lowercase in the application and then send it to the database.
The reason why I ask is because on MySQL this will pass:
While on PostgreSQL it will not pass:
The issue on MySQL is with the
_ci
collation. It sees accent characters likeú
the same asu
. But it will store the accent char.I think it would be safer if the
email
column was stored in_bin
.For PostgreSQL I don't really understand why a
citext
extension is installed for this purpose. If you go through all this trouble, why not simply do in the app?