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
When you do a query like select sum(amount) from my_table where user_id = $1 the return of the generated go function will be of type int64. However, when something such as a user doesn't exist, it returns a single NULL row rather than no rows:
-- name: CountActiveSubscriptions :one
SELECT SUM(quantity)
FROM subscriptions s
WHERE s.creator_id = $1
AND s.active = true
AND s.feature = $2
;
Version
1.24.0
What happened?
When you do a query like
select sum(amount) from my_table where user_id = $1
the return of the generated go function will be of typeint64
. However, when something such as a user doesn't exist, it returns a single NULL row rather than no rows:A solution is to wrap with
COALESCE(..., 0)::INT8
Relevant log output
No response
Database schema
Playground URL
No response
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: