Replies: 2 comments
-
Also, throwing it out there, I'd be happy to help with implementation, but figured I'd probe the space to see if this is a good idea first. |
Beta Was this translation helpful? Give feedback.
-
I think the main issue here is that it depends on the database system what should be accepted as Other than that the implementation should be actually quite straight forward as we could simply make the existing implementations accept more parameters by using something that implements |
Beta Was this translation helpful? Give feedback.
-
As currently implemented, limit and offset provide a way to set the LIMIT and OFFSET of a SQL query to a specific
i64
value.This is clearly the common case, and a worthwhile use-case to keep "easy" - however, there are situations where these values may be inferred as sub-queries.
For example, here's a SQL query attempting to select enough
user
s to could take on ajob
:This is an example query which may want to use a
LIMIT
that is only known at the time the query is issued. It would be possible to use an interactive transaction to perform this type of operation, but that would introduce unnecessary contention and latency.I've found this type of query particularly useful in the context of a CTE - we may want to conditionally operate on a limit, based on prior subqueries.
I believe eq_any actually provides some precedent here - this is an example of a query which can operate on a subquery, with values not known ahead-of-time.
I think something like the following might work:
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions