-
Notifications
You must be signed in to change notification settings - Fork 346
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
Jdbc context run action returning result is type as single value instead of list #2254
Comments
I'm having the same problem. I'd offer to fix it myself but I'm going to be busy with personal matters for the next few weeks. Hopefully I'll have some time to take a look and the issue is simple enough that a novice like me can fix it. This seems especially strange to me because update/delete should be able to return zero results without error so this behavior seems simply incorrect. |
Yeah, it definitely sounds incorrect. @tflucke if you want to look into it I can try to provide some guidance. |
Perhaps consider making it "returningList" or similar and possibly deprecating and renaming "returning" to "returningOne"? I believe the root issue is JdbcRunContext.scala:65 just needs to not wrap
|
I started chasing this down (#2461). It doesn't look like it's too bad, but since executeActionReturning is part of the top level quill API it's a pretty impactful change. I think we should decide whether or not to change the existing api before chasing down all the implementations. OTOH, the existing api is more or less broken, so maybe a change is due? Implementing a new "returningList" or similar with more appropriate semantics would make it possible to limit the blast radius of the change, maintain backwards compatibility and possibly even maintain backwards binary compatibility. |
What would be the semantics of "returningOne"? What happens specifically when:
It seems contrary to the design philosophy of Quill to start introducing new semantics like this. Is the goal just to maintain backwards compatibility? If so, I would leave "returning" as-is deprecated and not introduce anything with identical functionality. If a user needs the old functionality, they can use ".headOption" or a match statement and write their own error handling (which should have been how this was originally handled). |
I think it should be |
Version: v3.8.0
Module: quill-jdbc
https://github.com/getquill/quill/blob/876cae2c6b56317f373426b6049a40273d8301d0/quill-jdbc/src/main/scala/io/getquill/context/jdbc/JdbcContext.scala#L24
Expected behavior
Delete returning should return a list as many value could have been deleted.
Actual behavior
Return only the first deleted value, same behavior on update. (may be induce by insert returning?)
Steps to reproduce the behavior
Define a quote using returning on delete or update, result is a single value
Workaround
Unkown
@getquill/maintainers
The text was updated successfully, but these errors were encountered: