You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, Query will never return ErrNoRows. A query returning no rows is a perfectly valid result. Only QueryRow has the expectation of a non-empty result.
Second, the fact that your query has a left join is irrelevant to pgx. It sends the query and reads the result. The actual type of query doesn't matter. I suggest trying your query in psql. It probably is not returning what you expect.
Describe the bug
Query or QueryRow method does not return ErrNoRows error when using SQL left joins another table with where filter
To Reproduce
Sample SQL to reproduce the bug:
query :=
SELECT f.id, f.name FROM foo f LEFT JOIN bar b ON f.id = b.foo_id WHERE f.id = 123
Expected behavior
Query or QueryRow returns ErrNoRows error when no record is found
Actual behavior
Query or QueryRow returns no error when no record is found
Version
The text was updated successfully, but these errors were encountered: