[Oracle] Duplicate bug detection doesn't work when using Oracle databases.

RESOLVED FIXED in Bugzilla 4.0

Status

()

Bugzilla
Creating/Changing Bugs
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: Lee Millward, Assigned: Frédéric Buclin)

Tracking

4.0.1
Bugzilla 4.0
Bug Flags:
approval +
approval4.2 +
blocking4.2 +
approval4.0 +

Details

Attachments

(1 attachment)

1008 bytes, patch
Max Kanat-Alexander
: review+
Details | Diff | Splinter Review
(Reporter)

Description

6 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier: 4.0.1

I'm running two Bugzilla 4.0.1 installations on Oracle 11.2 and 10.2.0.1 databases and have found that the new duplicate bug detection never returned any potential duplicates, even when testing with a database containing a couple of bugs whose summaries are were as simple as "test one" and "test two" - entering "test" into the summary field of a new bug I consistently get no possible duplicates listed.

Digging a bit deeper, I found that when I ran I dumped the SQL within possible_duplicates in Bug.pm to a temp file and ran it manually in SQL Developer, I got "ORA-00920: invalid relational operator" on the CONTAINS clause.

Adjusting that to append a > 0 on the end (so the clause reads "WHERE (CONTAINS(bugs_fulltext.short_desc,'Test',1) > 0)" instead) gets past that particular error, but I then hit "ORA-00933: SQL command not properly ended", which is complaining about the "LIMIT 12" part of the query.

I was able to get around this by replacing the "LIMIT 12" with a "AND ROWNUM <= 12", but that's pretty Oracle specific so most likely isn't the correct fix, but it did result in potential duplicates being listed when creating a new bug.

Reproducible: Always

Steps to Reproduce:
1.Enter a bug with a summary "test bug" on a Bugzilla installation running on an Oracle database (reproduced on 10.2 and 11.2 databases.

2.Start to enter a second bug and set the summary on the new bug to "test" then wait for potential duplicates to be reported.


Actual Results:  
No duplicates will be listed underneath the summary field on the second bug.

Expected Results:  
The first bug should be listed as a potential duplicate.

Comment 1

6 years ago
This may be a bug in our Oracle driver, the code it uses to figure out LIMIT may not be working here.
Summary: Duplicate bug detection doesn't work when using Oracle databases. → [Oracle] Duplicate bug detection doesn't work when using Oracle databases.
(Assignee)

Comment 2

6 years ago
Bugzilla::Bug::possible_duplicates() uses LIMIT hardcoded instead of $dbh->sql_limit().
Status: UNCONFIRMED → NEW
Depends on: 22353
Ever confirmed: true
Flags: blocking4.2+
OS: Windows XP → All
Hardware: x86 → All
Target Milestone: --- → Bugzilla 4.0
Version: unspecified → 4.0.1
(Assignee)

Comment 3

6 years ago
Created attachment 552823 [details] [diff] [review]
patch, v1

This fixes the problem with Oracle 10.2.
Assignee: create-and-change → LpSolit
Status: NEW → ASSIGNED
Attachment #552823 - Flags: review?(mkanat)

Comment 4

6 years ago
Comment on attachment 552823 [details] [diff] [review]
patch, v1

Review of attachment 552823 [details] [diff] [review]:
-----------------------------------------------------------------

::: Bugzilla/DB/Oracle.pm
@@ +177,4 @@
>      my ($self, $column, $text, $label) = @_;
>      $text = $self->quote($text);
>      trick_taint($text);
> +    return "CONTAINS($column,$text,$label) > 0", "SCORE($label)";

Why is CONTAINS > 0 necessary? That looks like a MySQL-ism.
(Assignee)

Comment 5

6 years ago
(In reply to Max Kanat-Alexander from comment #4)
> Why is CONTAINS > 0 necessary? That looks like a MySQL-ism.

Because Oracle fails without it? :)
(Assignee)

Comment 6

6 years ago
Also, examples on the Oracle website use CONTAINS(...) > 0.

Comment 7

6 years ago
Comment on attachment 552823 [details] [diff] [review]
patch, v1

Sounds good to me, then! :-)
Attachment #552823 - Flags: review?(mkanat) → review+

Updated

6 years ago
Flags: approval4.2+
Flags: approval4.0+
Flags: approval+
(Assignee)

Comment 8

6 years ago
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/Bug.pm
modified Bugzilla/DB/Oracle.pm
Committed revision 7922.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/
modified Bugzilla/Bug.pm
modified Bugzilla/DB/Oracle.pm
Committed revision 7902.

Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.0/
modified Bugzilla/Bug.pm
modified Bugzilla/DB/Oracle.pm
Committed revision 7643.
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
(Assignee)

Updated

6 years ago
Duplicate of this bug: 685129
(Assignee)

Updated

6 years ago
Duplicate of this bug: 699760
(Assignee)

Updated

6 years ago
Duplicate of this bug: 702864
You need to log in before you can comment on or make changes to this bug.