Open meblum opened 2 months ago
1.27.0
Querying SELECT SUM(val) FROM authors will return interface{} instead if int
SELECT SUM(val) FROM authors
interface{}
int
No response
CREATE TABLE authors ( val INT NOT NULL );
-- name: GetSum :one SELECT SUM(val) FROM authors;
{ "version": "2", "sql": [{ "schema": "schema.sql", "queries": "query.sql", "engine": "mysql", "gen": { "go": { "out": "db" } } }] }
https://play.sqlc.dev/p/a38fb22db5ce7e2309fd44c197b20ade5e3b8f8f61085b8b39656ee651ff4ddf
MySQL
Go
Same BTW for MAX() with PostgreSQL on an INTEGER-type column. Seems like a more general issue.
MAX()
INTEGER
I had started on this a long time ago: https://github.com/sqlc-dev/sqlc/pull/3223
It wasn't trivial to fix sadly.
Version
1.27.0
What happened?
Querying
SELECT SUM(val) FROM authors
will returninterface{}
instead ifint
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/a38fb22db5ce7e2309fd44c197b20ade5e3b8f8f61085b8b39656ee651ff4ddf
What operating system are you using?
No response
What database engines are you using?
MySQL
What type of code are you generating?
Go