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

fix missing unsigned param #2522

Merged
merged 3 commits into from
Jul 25, 2023
Merged

Conversation

hiroebe
Copy link
Contributor

@hiroebe hiroebe commented Jul 25, 2023

Fixes #2432

@kyleconroy
Copy link
Collaborator

@hiroebe Thanks for the fix. Could I ask you to add a new end-to-end test that includes the examples from #2432?

To do this, create a new directory inside the internal/endtoend/testdata directory named unsigned_params. In that directory copy the sqlc.json and query.sql files from the issue and generate new output using your fix.

Thanks!

@hiroebe
Copy link
Contributor Author

hiroebe commented Jul 25, 2023

@kyleconroy Thanks for the instruction. I've added a new end-to-end test.
I didn't copy the schema and queries as it is in the issue but added a smaller example. That small one should be enough to reproduce the bug being fixed, but let me know if you think the original example in the issue is more suitable.

INSERT INTO foo (id) VALUES (?)
`

func (q *Queries) CreateFoo(ctx context.Context, id uint32) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The id parameter was previously generated as int32 while it's unsigned in MySQL schema.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this will be a breaking change, but it's necessary, as the existing code can lead to overflow errors.

@kyleconroy kyleconroy merged commit e3c657d into sqlc-dev:main Jul 25, 2023
7 checks passed
@hiroebe hiroebe deleted the fix-missing-unsigned branch July 25, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsigned types not present in query parameters
2 participants