Repository navigation
Database user backend improvements - #3939
icewind1991 wants to merge 9 commits into
Conversation
|
👍 |
There was a problem hiding this comment.
This assumes SQL LOWER() is equivalent to strtolower(). Is this guranteed?
There was a problem hiding this comment.
I believe it will be fine since we don't allow any special characters e.g. umlauts in usernames where strtolower and LOWER might act differently.
|
@icewind1991 What is the problem with using LOWER() in the first place? Issue #? |
|
If it is that LOWER isn't guaranteed work the same the same way as PHP strtolower, couldn't we instead do e.g. and don't use strtolower? |
|
The problem with lower is that it breaks indexes, since we're not querying the index but a function result. |
There was a problem hiding this comment.
Should we switch to executeAudited while we're in here?
|
I'm thinking that instead of a uid_lower column, we just store the lower case uid in the uid column and the proper case in the displayname column. If a display name is set we just overwrite the proper case, because it isn't necessary to keep around anymore. |
Because the non-lowercase uid is already used all over the place, so we need to keep that the same. |
|
Test passed. |
|
@DeepDiver1975 @MTGap @tanghus can this be merged? |
|
@icewind1991 is there a migration of data in here? for existing entries uid_lower has to be filled somehow - THX |
|
Yes, you can test it by trying to login after the upgrade or look at the db |
|
@icewind1991 please point me to the code which is doing the migration - THX |
|
Ok, I tested that and checked my slow query log that gives me information about which tables are accessed without using suitable indexes.
Are we sure that in all the tables which use the uid string we use the correct way (weather its lowercase or not , dunno) ? And, the population of the new lowercase column did not happen automatically for me, I had to update by hand. The column was created on upgrade. |
@icewind1991 this is what I've been asking for ... 👿 |
|
Strange, the upgrade mechanism worked for me when I last tested it, will look into it. |
|
@icewind1991 What's the current status on this? |
|
What is the status of that? I still think this is a good idea in general. |
|
Will close this one for now, similar improvements are better made in a new pr if needed |
Adds a field
uid_lowerto the database (filled during upgrade) as a way to prevent having to use LOWER() in the sql and make proper use of indexes.Also some generic cleanup for the backend.
cc @karlitschek @DeepDiver1975 @dragotin @tanghus