Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queries with inline views dont hit slave #183

Open
mathieuripert opened this issue Nov 28, 2017 · 2 comments
Open

Queries with inline views dont hit slave #183

mathieuripert opened this issue Nov 28, 2017 · 2 comments

Comments

@mathieuripert
Copy link

sql queries with inline views are redirected to master because they do not match the SQL_SLAVE_MATCHERS here https://github.com/taskrabbit/makara/blob/master/lib/active_record/connection_adapters/makara_abstract_adapter.rb#L112

Example:

with users as (
select id, name from users where active is true
)
select * from users 

this query will be redirected to master, whereas it can be queried on slave.
Is there a reason for that that i am missing ?

@bleonard
Copy link
Contributor

the /A means "start of string" - so there's probably a new regex (or set of them) to write to handle the with case.

@jackcasey
Copy link

This seems to be addressed like the day before it was reported ><; with 7b1295f

Seems to work for me anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants