haskell-beam / haskell-beam/beam
updateReturning surprising behavior when assignments are empty
Open
enhancement
- Dominant language
- Haskell
- Stars
- 635
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Description
When using `updateReturning` as an optimized of `update` plus `select`, with a variable set of assignments, it's surprising that no rows are returned when the assignments are empty.
The behavior does make sense for use cases where you're only interested in the changes, so it seems like beam should have two functions. Perhaps `updateReturningChanged` and `updateReturningMatched`. The latter would perform a `SELECT` when the assignments are empty, because `UPDATE table SET WHERE ...` isn't valid syntax.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.