-
Notifications
You must be signed in to change notification settings - Fork 841
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
Generated sqlite query to update on conflict fails with missing param #3834
Comments
The generated query is missing two params. It should have six total. func (q *Queries) SavePin(ctx context.Context, arg SavePinParams) (Pin, error) {
row := q.db.QueryRowContext(ctx, savePin,
arg.Title,
arg.Url,
arg.ImageUrl,
arg.CreatedAt,
)
var i Pin
err := row.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.ImageUrl,
&i.CreatedAt,
)
return i, err
} Manually updating the generated query to the following fixes the error: func (q *Queries) SavePin(ctx context.Context, arg SavePinParams) (Pin, error) {
row := q.db.QueryRowContext(ctx, savePin,
arg.Title,
arg.Url,
arg.ImageUrl,
arg.CreatedAt,
arg.Title,
arg.ImageUrl,
)
var i Pin
err := row.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.ImageUrl,
&i.CreatedAt,
)
return i, err
} |
I forked and wrote a test that fails with the same error: https://github.com/joeriddles/sqlc/tree/joeriddles/3834 |
Using the
|
Looks to be related to: |
Version
1.27.0
What happened?
Using the schema and query to update a row on insertion conflict with the following Go test fails:
The test fails with this output:
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/f96a629951bbdfebc68f4cfd2810025dc258c82e832ad2b8d6792946b71379f1
https://play.sqlc.dev/p/a5be075614744d3a900e38b3061c790b5962f4966f1b09be4d57ec28aa65c792 (named params)
What operating system are you using?
macOS
What database engines are you using?
SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: