Commit 2d60910
committed
Dedupe sqlc.arg parameters wrapped in a type cast for MySQL
When a sqlc.arg() call was wrapped in a CAST (or MySQL's synthetic
MATCH...AGAINST type cast), the resulting Parameter was not marked as
named. Downstream struct-field generation then added numeric suffixes
to disambiguate identical names, producing spurious fields like
SearchTerm_3 alongside SearchTerm.
Capture the isNamed result from FetchMerge so the column correctly
reflects that it came from a named parameter, letting the code
generator reuse a single struct field for repeated sqlc.arg(name)
references.
Fixes #43761 parent 3f41c61 commit 2d60910
File tree
5 files changed
+43
-2
lines changed- internal
- compiler
- endtoend/testdata/params_duplicate/mysql
- go
5 files changed
+43
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| |||
Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
0 commit comments