Analysis checker should catch updates declared as queries and vice versa
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 379
- Avg merge
- 14m
- Merged PRs (30d)
- 8
Description
I made a silly mistake yesterday, defining something like this:
sql"DELETE FROM foo RETURNING lo_unlink(bar)".update
Basically, I used RETURNING clause to run an effect for each row being deleted, and declared this as an Update0, intending to ignore the results.
The problem is, Doobie analysis checker didn't catch this, resulting in a runtime exception when executing the Update0:
org.postgresql.util.PSQLException: A result was returned when none was expected.
I'd like for the checker to properly diagnose this problem in the future.
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 locating doobie's analysis checker and the Update0/query classification path, then reproduce the PostgreSQL RETURNING case shown in the issue. Done means the checker reports mismatches between declared updates and queries before runtime execution, covering both directions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, scala
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100