-
Notifications
You must be signed in to change notification settings - Fork 820
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
NEW DataQuery::exists now generates EXISTS SQL statements #8915
NEW DataQuery::exists now generates EXISTS SQL statements #8915
Conversation
I just realised I forgot to ensure tests are passing 🤦♂️ . I'll hope travis has good news. |
Ok the remaining failing tests are fixed by @sminnee's recent updates to consistent boolean return types and relies on a fix in 2.x of the postgres module. Should I update travis config or update my code to be compatible with older versions of postgres? |
It sounds like that should be done upstream, but you could patch it here too if you want to |
Looks like a great addition! If it’s possible to work around the BC issue I’d be happy to take this in |
3be475e
to
81e39aa
Compare
Ok I've updated this PR to only contain the |
I figured out the failing tests: #8934 |
I added a very simple test. I tried doing some craziness with aggregates and |
This pull request hasn't had any activity for a while. Are you going to be doing further work on it, or would you prefer to close it now? |
@emteknetnz this isn't waiting for the author |
I resolved the conflict but I'd probably give such an old branch a rebase before merging. |
… SQL "exists" query The exists query in SQL allows the query optimiser (engine specific) to execute these queries much faster - often only needing the presence of an index to return "yes it exists".
…e as it might rely on an aggregate
…electing boolean literals in SQL
69f2594
to
3575070
Compare
...rebased against 4 and updated the merge target. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the tests pass I'm happy with this.
Co-authored-by: Robbie Averill <robbie@averill.co.nz>
This PR adds an
exists
method to DataQuery that will generate anEXISTS
statement from the existing query. This basically looks like this:This is the preferred way to do these sorts of queries as the engine can just do checks like "does the
MyDataObject.SomeProperty
index have any entries fortrue
" - this can be a lot faster than counting results.