Why unable to use .order
and .limit
for update source?
#3831
jjangga0214
started this conversation in
Ideas
Replies: 1 comment
-
This is not supported because the DSL wouldn't translate to your query. diesel::update(foo
.filter(expired_at.ge(now))
.order(expired_at.asc()) // <=== THIS CAUSES COMPILE ERROR
.limit(1) // <=== THIS CAUSES COMPILE ERROR, TOO
)
.set(bar.eq(bar + 1)) Would we translated to: UPDATE foo
SET bar = bar + 1
WHERE expired_at > :now
ORDER BY expired_at
LIMIT 1 which is just not valid SQL. For your SQL example you need to use a subquery as you do in your query. That's already supported by diesel. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
This works.
While this doesn't.
What I want conceptually is this.
(Of course this is possible in SQL)
I wonder why this should not be permitted.
If there's no reason to disable this usage, I hope diesel supports it.
Beta Was this translation helpful? Give feedback.
All reactions