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

Force index doesn't work with infix query #3026

Open
feiluo-db opened this issue Apr 29, 2024 · 0 comments
Open

Force index doesn't work with infix query #3026

feiluo-db opened this issue Apr 29, 2024 · 0 comments

Comments

@feiluo-db
Copy link

This template isn't a strict requirement to open issues, but please try to provide as much information as possible.

Version:
3.16.2
Module: (e.g. quill-jdbc)
quill-jdbc
Database: (e.g. mysql)
mysql

Expected behavior

Trying to get force index work on a multi table join query.

Tried using raw query with infix and it turns out the force index part is removed in the compiled SQL query.

infix"""
SELECT A.c1, A.c2, B.c1
FROM A force index (iA)
JOIN B force index (iB)
ON A.c3 = B.c3
WHERE
...
""".as[Query[MyEntity]]

The compiled query became

SELECT x11.c1 AS _1, x11.c2 AS _2, x12.c1 AS _3
FROM A x01 
INNER JOIN B x12
ON x11.c3 = x12.c3
WHERE
...

Actual behavior

How can I make force index work

Steps to reproduce the behavior

If the issue can be reproduced using a mirror context, please provide a scastie snippet that reproduces it. See https://scastie.scala-lang.org/fwbrasil/Z2CeR2qHQJK6EyQWUBhANA as an example. Remember to select the correct Quill version in the left menu.

Workaround

@getquill/maintainers

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

No branches or pull requests

1 participant