spring-boot-data-r2dbc-jooq icon indicating copy to clipboard operation
spring-boot-data-r2dbc-jooq copied to clipboard

`executeReturningOne` is inconsistent with `fetchOne`

Open GeorgiPetkov opened this issue 3 years ago • 1 comments

While fetchOne is returning at most 1 record it also fails if more than 1 record is returned by the query. The latter is not true for executeReturningOne, it actually behaves like fetchAny.

Should be trivial to change executeReturningOne to return Mono.error in case of more than 1 record or maybe just replace the whole method with return executeReturning(query).singleOrEmpty().

GeorgiPetkov avatar May 07 '21 10:05 GeorgiPetkov

Thanks for your report. I think the R2DBC wrapper should behave like the original JOOQ methods.

In addition we should improve test coverage with some negative tests. Maybe further issues like this one can be uncovered.

gofabian avatar May 09 '21 18:05 gofabian