View Issue Details

IDProjectCategoryView StatusLast Update
0003997mantisbtsqlpublic2004-09-12 08:28
Reporternuclearspike Assigned ToNarcissus  
PrioritynormalSeverityminorReproducibilityrandom
Status closedResolutionfixed 
Product Versiongit trunk 
Fixed in Version0.19.0rc1 
Summary0003997: CVS: SQL error on View Bugs with certain filters
Description

User did a series of steps, got an SQL error, & she can no longer use View Bugs page.

Steps To Reproduce

One of our internal users was playing with filters and had gone into the Summary page and clicked on one of the numbers to go to view related bugs. It worked, then she navigated to another site. She used the Back button and was on the screen to select the project to open (with the "Set as default" option). From that page she clicked on View Bugs and got the error shown. You'll notice that there is a " AND () AND " in the middle of the where.

Additional Information

APPLICATION ERROR 0000401
Database query failed. Error received from database was 0001064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ((mantis_bug_table.status='10') OR (mantis_bug_table.stat for the query: SELECT COUNT( DISTINCT mantis_bug_table.id ) as count FROM mantis_bug_table, mantis_project_table WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis_bug_table.project_id AND ((mantis_bug_table.project_id='16') OR (mantis_bug_table.project_id='15') OR (mantis_bug_table.project_id='6') OR (mantis_bug_table.project_id='3') OR (mantis_bug_table.project_id='4') OR (mantis_bug_table.project_id='5') OR (mantis_bug_table.project_id='19') OR (mantis_bug_table.project_id='10') OR (mantis_bug_table.project_id='13')) AND (mantis_bug_table.view_state='10' OR mantis_bug_table.reporter_id='18') AND () AND ((mantis_bug_table.status='10') OR (mantis_bug_table.status='20') OR (mantis_bug_table.status='30') OR (mantis_bug_table.status='40') OR (mantis_bug_table.status='50'))

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section

TagsNo tags attached.

Activities

nuclearspike

nuclearspike

2004-07-02 10:48

reporter   ~0005868

be sure to "view advanced" to see the steps to reproduce.

nuclearspike

nuclearspike

2004-07-02 10:54

reporter   ~0005869

that should say (without linking to another bug) :
APPLICATION ERROR # 401

(oddly enough, bug 0000401 is the request to add support for automatic hyperlinking when you enter in a bug number into the report.)

jferraz

jferraz

2004-07-07 20:48

reporter   ~0005899

Confirmed in alpha release 0.19.0a1, here, on the "live" mantis bug tracker. Just tried to search for some text.

--
APPLICATION ERROR # 401

Database query failed. Error received from database was # 1064: You have an error in your SQL syntax near '(mantis_bug_table LEFT JOIN mantis_bugnote_table ON mantis_bugnote_table.bug_id ' at line 1 for the query: SELECT COUNT( DISTINCT mantis_bug_table.id ) as count FROM mantis_bug_text_table, mantis_project_table ,(mantis_bug_table LEFT JOIN mantis_bugnote_table ON mantis_bugnote_table.bug_id = mantis_bug_table.id) LEFT JOIN mantis_bugnote_text_table ON mantis_bugnote_text_table.id = mantis_bugnote_table.bugnote_text_id WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis_bug_table.project_id AND (mantis_bug_table.project_id='1') AND (mantis_bug_table.view_state='10' OR mantis_bug_table.reporter_id='4953') AND ((mantis_bug_table.status='10') OR (mantis_bug_table.status='20') OR (mantis_bug_table.status='30') OR (mantis_bug_table.status='40') OR (mantis_bug_table.status='50') OR (mantis_bug_table.status='80')) AND ((summary LIKE '%test%')
OR (mantis_bug_text_table.description LIKE '%test%')
OR (mantis_bug_text_table.steps_to_reproduce LIKE '%test%')
OR (mantis_bug_text_table.additional_information LIKE '%test%')
OR (mantis_bug_table.id LIKE '%test%')
OR (mantis_bugnote_text_table.note LIKE '%test%')) AND (mantis_bug_text_table.id = mantis_bug_table.bug_text_id)

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

leeguy

leeguy

2004-07-08 01:12

reporter   ~0005907

Last edited: 2004-07-08 01:21

It lookes like the brackets in the FROM part of the query (around the first LEFT JOIN) are causing the grief

core/filter_api.php: line 395 should look like
array_push( $t_join_clauses, ",$t_bug_table LEFT JOIN $t_bugnote_table ON $t_bugnote_table.bug_id = $t_bug_table.id" );

instead of:
array_push( $t_join_clauses, ",($t_bug_table LEFT JOIN $t_bugnote_table ON $t_bugnote_table.bug_id = $t_bug_table.id)" );

edited on: 07-08-04 01:14

edited on: 07-08-04 01:21

int2str

int2str

2004-07-08 02:43

reporter   ~0005908

I do not get that error on my server. Wonder if Victor did all the SQL updates when he updated today?

Victor?

Narcissus

Narcissus

2004-07-24 03:40

reporter   ~0006292

This issue doesn't seem to be the same as the text search one. Looking at the broken SQL, there's a problem with the filter somewhere between reporter and status. The fields that are filtered between reporter and status are:

  • handler
  • category
  • severity

If there is still a problem, I would guess that it's in amongst these three filter values.

Paul: Is there any chance of getting more information, as I can't replicate this issue at the moment.

nuclearspike

nuclearspike

2004-07-27 08:21

reporter   ~0006392

We have seen the error once since this report, but cannot seem to reliably reproduce it. It's always able to be worked around by just going to another page and coming back. We'll keep our eye out for it.

jlatour

jlatour

2004-08-06 11:50

reporter   ~0006725

Is this already a reproducable issue?

rkrentz

rkrentz

2004-08-17 08:20

reporter   ~0007028

Last edited: 2004-08-17 08:49

To reproduce. Is this the same issue?

You have to have several projects in Mantis.

  • Login
  • Choose a project
  • Click 'View Issues'
  • Use the Filter 'Assigned To:' and choose [Myself] - Apply this Filter
  • Choose 'All Projects'
  • Click 'View Issues'

It is very common used to view all bugs assigned to a person in all projects.

Edit: Mantis Version 0.19.0a2 from sf.net

Complete Error Message:

APPLICATION ERROR # 401

Database query failed. Error received from database was # 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ((mantis_bug_table.build=''))' at line 1 for the query: SELECT COUNT( DISTINCT mantis_bug_table.id ) as count FROM mantis_bug_table, mantis_project_table WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis_bug_table.project_id AND ((mantis_bug_table.project_id='16') OR (mantis_bug_table.project_id='21') OR (mantis_bug_table.project_id='5') OR (mantis_bug_table.project_id='13') OR (mantis_bug_table.project_id='4') OR (mantis_bug_table.project_id='7') OR (mantis_bug_table.project_id='8') OR (mantis_bug_table.project_id='1') OR (mantis_bug_table.project_id='2') OR (mantis_bug_table.project_id='10')) AND (mantis_bug_table.view_state='10' OR mantis_bug_table.reporter_id='5') AND () AND ((mantis_bug_table.build=''))

edited on: 08-17-04 08:49

edited on: 08-17-04 08:49

nuclearspike

nuclearspike

2004-08-17 08:44

reporter   ~0007029

I tried these steps and it did not cause an error for me. I'm not using the official .19 release but a CVS version from about a week ago.

grangeway

grangeway

2004-08-20 19:30

reporter   ~0007088

I think this issue has been fixed in cvs - The SQL statement of "AND () AND " might not be valid.

For this to occur, one of the itesm in the $t_where_clause arrays needs to be an empty string. The only places where_clause is set are:

array_push( $t_where_clauses, "($t_bug_text_table.id = $t_bug_table.bug_text_id)" );
..
array_push( $t_where_clauses,
"((summary LIKE '%$c_search%')
...
if ( !is_blank( $t_custom_where_clause ) ) {
array_push( $t_where_clauses, $t_custom_where_clause . ')' );
}

etc etc etc... none of which would produce an empty string

Are you still able to get this issue to occur?

rkrentz

rkrentz

2004-08-30 07:52

reporter   ~0007302

This problem no longer appears in version 0.19.0rc1.
Works for me now.