palkan / n_plus_one_control

RSpec and Minitest matchers to prevent N+1 queries problem
MIT License
553 stars 20 forks source link

Support table names surrounded by backtick #41

Closed andrewhampton closed 3 years ago

andrewhampton commented 3 years ago

What is the purpose of this pull request?

In our rails app, the query looks like this:

SELECT `users`.* FROM `users` WHERE `users`.`account_id` = 1 AND `users`.`id` = 1 LIMIT 1

This PR adds support for table names surrounded by backticks in addition to the current support for single and double quotes.

What changes did you make? (overview)

Slight tweak to the EXTRACT_TABLE_RXP regular expression.

Is there anything you'd like reviewers to focus on?

Checklist

palkan commented 3 years ago

Thanks!