LIMIT argument is incorrectly set to 2 instead of 1
aeneasr opened this issue · comments
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- This issue affects my Ory Network project.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Describe the bug
Calls to checkDirect
perform a GetRelationTuples
query with x.WithSize(1)
to check whether a tuple was found or not.
Lines 162 to 179 in a39325c
For some reason though, we use the limit + 1 in the query:
keto/internal/persistence/sql/relationtuples.go
Lines 215 to 218 in a39325c
So what should be LIMIT 1
(we have a binary question - does it exist or not?) we end up with LIMIT 2
Reproducing the bug
Look at a GetActiveProject
trace in Grafana.
Relevant log output
No response
Relevant configuration
No response
Version
master
On which operating system are you observing this issue?
None
In which environment are you deploying?
None
Additional Context
No response
I understand why this is done like this - we use the +1 offset to check if there is another item we need to return pagination for. However, when we use a limit of 1 we don't want to see the next page anyways, I would say.