Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUM() returns interface{} type for mysql #3579

Open
meblum opened this issue Sep 4, 2024 · 1 comment
Open

SUM() returns interface{} type for mysql #3579

meblum opened this issue Sep 4, 2024 · 1 comment
Labels
📚 mysql bug Something isn't working 🔧 golang

Comments

@meblum
Copy link
Contributor

meblum commented Sep 4, 2024

Version

1.27.0

What happened?

Querying SELECT SUM(val) FROM authors will return interface{} instead if int

Relevant log output

No response

Database schema

CREATE TABLE authors (
  val   INT NOT NULL
);

SQL queries

-- name: GetSum :one
SELECT SUM(val) FROM authors;

Configuration

{
  "version": "2",
  "sql": [{
    "schema": "schema.sql",
    "queries": "query.sql",
    "engine": "mysql",
    "gen": {
      "go": {
        "out": "db"
      }
    }
  }]
}

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

@meblum meblum added the bug Something isn't working label Sep 4, 2024
@curio77
Copy link

curio77 commented Sep 6, 2024

Same BTW for MAX() with PostgreSQL on an INTEGER-type column. Seems like a more general issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 mysql bug Something isn't working 🔧 golang
Projects
None yet
Development

No branches or pull requests

2 participants