0

Let's say I wanna update a row where this ID ('UBI1075') exist. When I update a row using the right ID, it's good, as it should be. But when I put the wrong ID (let's say 'UBI1077'), PostgreSQL doesn't show any error message, instead it returns a message "Affected rows: 0"

How can I tell the user that the update did nothing or there is no such ID?

  • 1
    Get the [number of affected rows from the result](https://pkg.go.dev/database/sql#Result.RowsAffected). Report an error if the number is zero. – Charlie Tumahai Nov 12 '22 at 19:47

0 Answers0