yesodweb / yesodweb/persistent
Delete query run with rawExecute throws exception when nothing was deleted
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
If you use rawExecute to run a delete query, a strange exception is thrown if nothing was actually deleted:
Log: DELETE FROM table WHERE field = 'foo'; []
*** Exception: SqlError {sqlState = "", sqlExecStatus = CommandOk, sqlErrorMsg = "", sqlErrorDetail = "", sqlErrorHint = ""}
Whereas if you use one of the cooked Persistent combinators like deleteBy, Persistent is perfectly happy if the query doesn't actually delete anything. The SQL that shows in the log is exactly the same.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the empty-delete case with rawExecute and compare it with the cooked deleteBy combinator described in the issue. Trace how each path handles the reported DELETE result and check the relevant backend implementations. Done means rawExecute does not throw when no rows are deleted, while normal errors still surface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100