Version
1.31.1
What happened?
When running sqlc 1.31.1 with go tool sqlc generate I dont get any error log, but the output does not include the specified parameter. I would expect a timestamp parameter in this example.
Expectation:
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: query.sql
package db
import (
"context"
"time"
)
const updateEntities = `-- name: UpdateEntities :execrows
UPDATE target_table
SET active = 0
WHERE EXISTS (
SELECT 1
FROM source_table s
WHERE s.updated_at >= ?
)
`
func (q *Queries) UpdateEntities(ctx context.Context, updatedAfter time.Time) (int64, error) {
result, err := q.db.ExecContext(ctx, updateEntities, updatedAfter)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
Actual output:
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.25.0
// source: query.sql
package db
import (
"context"
)
const updateEntities = `-- name: UpdateEntities :execrows
UPDATE target_table
SET active = 0
WHERE NOT (
EXISTS (
SELECT 1
FROM source_table s
WHERE s.updated_at >= sqlc.arg(updated_after)
)
)
`
func (q *Queries) UpdateEntities(ctx context.Context) (int64, error) {
result, err := q.db.ExecContext(ctx, updateEntities)
if err != nil {
return 0, err
}
return result.RowsAffected()
}
Relevant log output
Database schema
CREATE TABLE target_table
(
id BIGINT PRIMARY KEY,
active BOOLEAN NOT NULL
);
CREATE TABLE source_table
(
id BIGINT PRIMARY KEY,
updated_at TIMESTAMP NOT NULL
);
SQL queries
-- name: UpdateEntities :execrows
UPDATE target_table
SET active = 0
WHERE NOT (
EXISTS (
SELECT 1
FROM source_table s
WHERE s.updated_at >= sqlc.arg(updated_after)
)
);
Configuration
{
"version": "2",
"sql": [{
"schema": "schema.sql",
"queries": "query.sql",
"engine": "mysql",
"gen": {
"go": {
"out": "db"
}
}
}]
}
Playground URL
https://play.sqlc.dev/p/29743a26dc241fe38660c6a2c7d7fb37505e1cecb4251f6f0876a14747efb431
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Edit: Make the problem more clear, by adding expectation/ reality
Version
1.31.1
What happened?
When running sqlc 1.31.1 with
go tool sqlc generateI dont get any error log, but the output does not include the specified parameter. I would expect a timestamp parameter in this example.Expectation:
Actual output:
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/29743a26dc241fe38660c6a2c7d7fb37505e1cecb4251f6f0876a14747efb431
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Edit: Make the problem more clear, by adding expectation/ reality