projectnami icon indicating copy to clipboard operation
projectnami copied to clipboard

MySQL FORCE INDEX query hints cause invalid SQL

Open rmc47 opened this issue 6 years ago • 0 comments

bbPress uses a MySQL query hint in its WHERE clause filter: https://bbpress.trac.wordpress.org/browser/trunk/src/includes/replies/functions.php#L2042

This generates a query like SELECT col FROM foo FORCE INDEX (PRIMARY, col) WHERE..., which is invalid T-SQL.

While T-SQL does have query hints, it's probably not a simple translation to use them since they're index-name-based rather than column-based, so it's probably simplest just to strip the hints from the query.

rmc47 avatar Mar 15 '19 09:03 rmc47