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

The input for the comparison to the sum of length should be of type int. #3332

Open
mondy opened this issue Apr 13, 2024 · 0 comments
Open
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@mondy
Copy link

mondy commented Apr 13, 2024

Version

1.26.0

What happened?

Input:

-- name: GetAuthor :one
SELECT 1 WHERE (SELECT sum(length(data)) FROM authors ) < ?;

Output:

func (q *Queries) GetAuthor(ctx context.Context, data []byte) (int64, error) {
	row := q.db.QueryRowContext(ctx, getAuthor, data)
	var column_1 int64
	err := row.Scan(&column_1)
	return column_1, err
}

The type of the data in the argument is []byte, but it should be int.

Relevant log output

No response

Database schema

CREATE TABLE authors (
  data BLOB NOT NULL
);

SQL queries

-- name: GetAuthor :one
SELECT 1 WHERE (SELECT sum(length(data)) FROM authors ) < ?;

Configuration

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

Playground URL

https://play.sqlc.dev/p/7ef7f0176111eac4db0a7ad80028c75b4c030ce9cd6a1113ee4b9c29b35051f8

What operating system are you using?

Windows

What database engines are you using?

SQLite

What type of code are you generating?

Go

@mondy mondy added bug Something isn't working triage New issues that hasn't been reviewed labels Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed
Projects
None yet
Development

No branches or pull requests

1 participant