Closed (fixed)
Project:
Privatemsg
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 May 2009 at 21:20 UTC
Updated:
16 Aug 2009 at 10:13 UTC
Jump to comment: Most recent file
Comments
Comment #1
naheemsays commentedIt's not case sensitive here. What database backend are you using?
Comment #2
berdirPostreSQL's LIKE is not case insensitive..
Comment #3
naheemsays commentedDo you think it may be a good idea to use the function LOWER() or UPPER() to make it all as database agnostic as possible?
(I think that finction exists in postgres and mysql, but have no idea about others...)
Comment #4
litwol commentedi would like to avoid using this method as it is extremely slow because using LOWER or UPPER prevents using table indexes
Comment #5
berdirMe too, but we can't avoid it, not in D6. Core is currently doing the same thing and will hopefully add lower-case fields for things like username and taxonomy terms.
user_load() is using lower() anyway, so we should be consistent.
Comment #6
litwol commentedIf we are going to support case agnostic solutions then we should start caching people's names in a new table {uid, LOWER(name)} in hook_user_{$register|$edit|...} or something.
Comment #7
spydmobile commentedI understand the issues you face but I consider this a real usability issue, normal folks just dont understand why they have to type caps in one user lookup in drupal but not in another in the same site. I would rather take the performance hit than the usability hit, Just more pennies to add to my initial 2 cents... But I like the idea of a cache table as you have mentioned. I would be happy for anything that makes my users life easier.
F
Comment #8
spydmobile commentedAlso, I am indeed a postgres shop and postgress does support upper as does php. so it can be done in the database or in the module.
Comment #9
naheemsays commentedis there some way to automagically switch to ILIKE for postgres?
If Mysql could also support ILIKE (which for it would be the same has LIKE...), things would be easier.
Comment #10
berdirWhile we are working on it, you can easily change it with a simple hook, if you know a bit PHP:
See
http://blog.worldempire.ch/api/group/sql/1
http://blog.worldempire.ch/api/function/hook_privatemsg_sql_autocomplete...
http://blog.worldempire.ch/api/function/privatemsg_sql_autocomplete/1
Create a yourmodule_privatemsg_sql_autocomplete_alter hook and replace the LIKE in the first where part. And please post your hook here so that others can use it too, if they want.
Edit: BTW, PostgreSQL does support LOWER()
Comment #11
naheemsays commentedwould an str_replace work?
Something like:
??
Comment #12
berdirIt should if you replace it in $fragments['where'][0].
Comment #13
naheemsays commentedok, attaching a patch for the query builder that should solve this for pgsql - However I do not have pgsql installed so testing will have to be done by others.
Comment #14
spydmobile commentedI am on the road right now, but I will be back in the office and test this patch tomorrow and feedback here.... And thanks for speeding a solution through folks!
Franco
Comment #15
spydmobile commentedOk, just hand bombed the lines into the module and installed in vannila d6, problem solved, thanks so much guys!!!
Franco
Comment #16
naheemsays commentedComment #17
berdirNice little patch that gets it working without loosing the performance on MySQL.
Comment #18
litwol commentedAquote of dries' quote from http://lists.drupal.org/pipermail/development/2007-January/021942.html : Removal of ilike searches. Use lower() = lower() it is faster.
Comment #19
litwol commentedCommitted. thank you!