Beta breaker: access rules are broken.

hswong3i - August 7, 2007 - 08:22
Project:Drupal
Version:6.x-dev
Component:database system
Category:bug report
Priority:critical
Assigned:hswong3i
Status:closed
Description

DB2 only support "column LIKE column" or "column LIKE text", but not "text LIKE column". this patch fix this minor problem based on cross database compatibility concern.

AttachmentSizeStatusTest resultOperations
drupal-6.x-dev-like-0.1.diff1.64 KBIgnoredNoneNone

#1

Dries - August 7, 2007 - 08:41
Status:needs review» fixed

Committed to CVS HEAD. Thanks! :)

#2

Rok Žlender - August 15, 2007 - 21:29
Priority:normal» critical
Status:fixed» active

I think this patch broke at least user access rules on mysql. Now masks like '%block%' do not work anymore. If you switch back to "text LIKE column" it works again.

I tested this on mysql 5.0.19

Example:
mask = %block%

SELECT * FROM `access` WHERE mask LIKE 'tblockt'
returns 0 results

SELECT * FROM `access` WHERE 'tblockt' LIKE mask
returns the correct result

#3

hswong3i - August 16, 2007 - 02:56

BTW, when i test with following SQL, on MySQL 5.0.32-Debian_7etch1, it works fine:

mysql> SELECT * FROM `term_data` WHERE LOWER('%') LIKE LOWER(name);
Empty set (0.00 sec)

mysql> SELECT * FROM `term_data` WHERE LOWER(name) LIKE LOWER('%');
...
...
52 rows in set (0.00 sec)

i test it with Oracle 10gR2, and the result is similar: case 1 comes with empty result set, where case 2 returns values. so at least, it is not an issue with my MySQL server; on the other hand, it is also not an issue for Oracle. as this patch is mainly target for DB2, so surly it is also functioning with it :)

#4

hswong3i - August 18, 2007 - 09:05
Assigned to:Anonymous» hswong3i
Status:active» fixed

@Rok Žlender: as there is no further update from you, and this patch is fully tested in both MySQL/Oracle/DB2/MSSQL, i will assume this issue as closed. if you still face some other problems, please feel free to attach more information, and i will try my best to repeat your case for testing :)

#5

hswong3i - August 18, 2007 - 10:14
Status:fixed» duplicate

@Zlender: thanks for your bug report, and i will solve that bugs within other issue: http://drupal.org/node/168403, and so this issue will make as duplicated :)

#6

mooffie - August 20, 2007 - 03:25

>
> SELECT t.tid, t.* FROM {term_data} t WHERE WHERE LOWER('%s') LIKE LOWER(t.name)
>

Isn't this weird? Why not simply do WHERE LOWER('%s') = LOWER(t.name)?

I tried to trace the history of this line[1]. It seems that in those days the taxonomy module was quite different than what it is today[2] and the use of LIKE invaded this line as well. (Do you want me to prepare a patch that removes this LIKE?)

[1] http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/taxonomy/taxonomy....

[2] http://cvs.drupal.org/viewvc.py/drupal/drupal/modules/taxonomy/taxonomy....

#7

hswong3i - August 20, 2007 - 04:00

@mooffie: sorry that i can't find the line that you point out, from latest CVS HEAD. would you mind to have a double check?

#8

mooffie - August 20, 2007 - 04:31

>
> i can't find the line that you point out

I quoted this line from your patch. It's in one of the two lines that you've changed.

(I didn't criticize your code but the code of our "forefathers" :-)

#9

chx - September 3, 2007 - 06:27
Title:update LIKE as SQL friendly» Beta breaker: access rules are broken.
Status:duplicate» reviewed & tested by the community

The must be rolled back as it broke MySQL. @hswong3i: replacing a trivial but critical bugfix with a complicated feature request is not a duplicate!

AttachmentSizeStatusTest resultOperations
rollback_2.patch735 bytesIgnoredNoneNone

#10

hswong3i - September 3, 2007 - 06:41

@chx: thanks about this patch. as i am now working for same thing, you save my time for duplicate work, many thanks :)

P.S. i can SIMPLIFY that implementation (http://drupal.org/node/168403) into VERY simple, or even lossy than current implementation. but will you accept for something like that? i don't really think so. i think we will not accept something that don't give any improvement, and that's why i try to extend it. and the result is not too bad: feature is extended, with no performance drop, and cross database compatible.

so why not accepting it? surly because it is something too late. i will postpone that extension into D7, so would you feel much better about that?

#11

Dries - September 3, 2007 - 16:55
Status:reviewed & tested by the community» fixed

Committed to CVS HEAD. Thanks.

#12

Anonymous - September 17, 2007 - 17:11
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.