Skip to content
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

InsertReturningStep.returning(fields) should return InsertResultStep<Record>, not InsertResultStep<R> #5622

Closed
tomdcc opened this issue Oct 31, 2016 · 4 comments

Comments

@tomdcc
Copy link

tomdcc commented Oct 31, 2016

Fairly minor: I went to use a returned result from one of these calls, and to my surprise the IDE reported various methods on the row to get specific columns - these had been generated on a MyTableRecord class that was the generic parameter for the table that I had inserted into.

These columns were not in the list of columns that I had supplied to the returning() clause, and shouldn't be available - as soon as we return a specific set, we don't know anything about the returned tuple. In addition, I thought that maybe I could use one of these methods to get at the columns that I had returned, but they are hardcoded to use specific positional indexes rather than column names, so they're misleading.

We should just return InsertResultStep<Record> from these methods.

@lukaseder
Copy link
Member

Thank you very much for reporting. You're absolutely right and I'm almost sure this is a duplicate (although I cannot seem to find the other issue).

Unfortunately, this would be a breaking change both from an API perspective as well as from a behaviour perspective - which means it cannot be implemented in a near future minor release. But this should definitely be fixed in jOOQ 4.0

@lukaseder
Copy link
Member

lukaseder commented Oct 18, 2017

As discussed in #5688 (comment), we might fix this breaking change in 3.11 - a minor release. The issue has been brought up quite a few times, and the breaking change is limited to a very narrow area of the jOOQ API. The current behaviour is really flawed - the query that gets sent to the server is capable of fetching any type of record, e.g. Record, but the API and the execution allow only for R types to be fetched.

With this fix, we'll also implement #6715, giving additional access to record-level type safety.

@lukaseder
Copy link
Member

After an initial refactoring attempt, it has become clear that this is, after all, a significant change. This will need more thought.

@lukaseder
Copy link
Member

We'll support arbitrary expressions both in generated SQL (#5688) and as result types (#6715, #7475) in jOOQ 3.11. To work around backwards compatibility issues, the new feature will be supported through new API, rather than retrofitting the existing API.

The new API is called returningResult(). The minor inconvenience of having this alternative method name is less bad than breaking backwards compatibility for thousands of applications out there.

In jOOQ 4.0, the returning() methods can be changed incompatibly to do the same thing as the new returningResult() methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants