Node Reference Autocomplete is case sensitive in PostgreSQL. So typing in 'John' will not find a node named 'john' and vice-versa.

It looks like the private message module had a similar issue and managed to fix it:

http://drupal.org/node/462982

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neilnz’s picture

Version: 6.x-2.2 » 6.x-2.3
Status: Active » Needs review
FileSize
863 bytes

Attached a patch that I used to fix this issue for me (replaced LIKE with ILIKE when using pgsql)

jamespharaoh’s picture

FileSize
794 bytes

The previous patch submitted will change the word LIKE indiscriminately throughout the SQL statement. My patch, attached, will only change it where appropriate.

neilnz’s picture

Status: Needs review » Reviewed & tested by the community

Backed out my patch from #1 and applied #2, confirmed working as expected on Postgres 8.3.7.

neilnz’s picture

Version: 6.x-2.3 » 6.x-2.x-dev

This is still an issue in latest 2.x-dev and 3.x-dev. Could someone please apply this?

carpo’s picture

Just came across this issue myself, and noticed that the change also has to be made in the function content_plugin_display_references in content_plugin_display_simple.inc and the function _userreference_potential_references_standard in userreference.module

KarenS’s picture

Status: Reviewed & tested by the community » Needs work

Sounds like this patch is not complete and no one has confirmed that it doesn't break things in MYSQL.

Josh Waihi’s picture

Status: Needs work » Reviewed & tested by the community

#2 will work fine in PostgreSQL and will not effect MySQL. I RTBC this, but it is also an issue in user reference. could we get that fixed there too?

KarenS’s picture

Status: Reviewed & tested by the community » Needs work

I marked this needs work because #5 says there are more places that need to be fixed, so the patch is not ready. Does 'will not affect MYSQL' mean you actually tested it or are you just guessing?

neilnz’s picture

Status: Needs work » Needs review
FileSize
2.81 KB

Here's a new patch, incorporating the fix from #2 in those other places

neilnz’s picture

I just tested this patch on MySQL and Postgres on a fresh install of Drupal 6 CVS with CCK 2.x-dev from the project page both with and without the patch.

I created two fields on the default page type, a nodereference autocomplete ("contains") and a similar userreference autocomplete field.

I created a page and user with mixed case title/username and then attempted to reference them.

MySQL was case-insensitive both before and after the patch, Postgres was case sensitive before but not after, so I'm very confident that my patch from #9 doesn't affect MySQL, and solves both nodereference and userreference autocomplete case sensitivity issues on Postgres.

Thanks

KarenS’s picture

Status: Needs review » Fixed

Thanks for the very complete patch and report, fixed committed.

Fidelix’s picture

The patch returned:

patching file cck/includes/views/handlers/content_plugin_display_simple.inc
Hunk #1 FAILED at 22.
1 out of 1 hunk FAILED -- saving rejects to file cck/includes/views/handlers/content_plugin_display_simple.inc.rej
patching file cck/modules/nodereference/nodereference.module
Hunk #1 FAILED at 876.
1 out of 1 hunk FAILED -- saving rejects to file cck/modules/nodereference/nodereference.module.rej
patching file cck/modules/userreference/userreference.module
Hunk #1 FAILED at 774.
1 out of 1 hunk FAILED -- saving rejects to file cck/modules/userreference/userreference.module.rej

Sorry if its my noobiness.

neilnz’s picture

@Fidelix, make sure you're using CCK 6.x-2.x-dev, otherwise this patch won't apply and you'll have to backport it manually.

The changes are relatively minor (6 lines changed across 3 files), so you should be able to do it by hand if you need to.

KarenS’s picture

The patch is committed. If you use the dev version it is there.

Fidelix’s picture

Sorry, i was using 3.x. My bad.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.