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

SQL query with sql funcs can generate duplicate fields #4859

Open
matt2e opened this issue Mar 13, 2025 · 0 comments
Open

SQL query with sql funcs can generate duplicate fields #4859

matt2e opened this issue Mar 13, 2025 · 0 comments
Labels
bug Something isn't working next Work that will be be picked up next

Comments

@matt2e
Copy link
Collaborator

matt2e commented Mar 13, 2025

Not sure if this is a sqlc bug or an FTL one.
Steps:

  • ftl dev examples/go/mysql
  • Add this to that module's queries.sql file:
-- name: CreateConcatRequest :exec
INSERT INTO requests (data) VALUES (CONCAT(LOWER(?), LOWER(?)));

This generates this invalid struct with duplicate fields:

type CreateConcatRequestQuery struct {
  	Lower string
  	Lower string
}

Workaround: use named args

-- name: CreateConcatRequest :exec
INSERT INTO requests (data) VALUES (CONCAT(LOWER(sqlc.arg(part1)), LOWER(sqlc.arg(part2))));
@github-actions github-actions bot added the triage Issue needs triaging label Mar 13, 2025
@bradleydwyer bradleydwyer added bug Something isn't working next Work that will be be picked up next labels Mar 25, 2025
@github-actions github-actions bot removed the triage Issue needs triaging label Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next Work that will be be picked up next
Projects
None yet
Development

No branches or pull requests

2 participants