fix(select): do not force set subQuery to false#13490
Conversation
this occurred on validating included elements in spite of user set it to true in include options
|
Let me know if I'm using incorrect find options, I also tried using |
|
Hey @floydspace, thanks for your work. Do you think we have to update any documentation or are we just fixing it as such as you would have expected to begin with. I have to admit that I only understand half of what is going on here, but I can tell that we are generating a broken SQL query and it's better now :D |
|
@sdepold I understand even less, so I hope there are no uncovered cases, at least it's not getting worse. |
|
🎉 This PR is included in version 6.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* fix(select): do not force set subQuery to false this occurred on validating included elements in spite of user set it to true in include options * test: make include (subQuery alias) tests dry Co-authored-by: Victor Korzunin <victor.korzunin@blanco.services> Co-authored-by: Constantin Metz <58604248+Keimeno@users.noreply.github.com> Co-authored-by: Sascha Depold <sdepold@users.noreply.github.com>
This occurs on validating included elements function in spite of a user sets it to
trueinincludeoptionsPull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Here it is the SSCCE:
What do you expect to happen?
I expect that query would not use not existing alias
What is actually happening?
But it generated query like this:
as you can see in line 3 it joins to the
Userstable but theUsersalias is not exist in current sub select scope, it has been concatenated at the end of query. So DB returns error:Unknown column 'Users.professionId' in 'on clause'.The following PR fixes the issue, for me at least. And now generates the following SQL:
All tests look fine.
Please have a look on it.