Skip to content

Commit a2b6b18

Browse files
authored
fix(validate): sqlc.arg & sqlc.narg are not "missing" (#1814)
1 parent 32010e9 commit a2b6b18

File tree

5 files changed

+189
-5
lines changed

5 files changed

+189
-5
lines changed

internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/db.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/models.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/sqlc_narg/postgresql/stdlib/go_strict/query.sql.go

Lines changed: 119 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
{
2-
"version": "1",
3-
"packages": [
2+
"version": "2",
3+
"sql": [
44
{
55
"engine": "postgresql",
6-
"path": "go",
7-
"name": "querytest",
86
"schema": "query.sql",
9-
"queries": "query.sql"
7+
"queries": "query.sql",
8+
"gen": {
9+
"go": {
10+
"package": "querytest",
11+
"out": "go"
12+
}
13+
}
14+
},
15+
{
16+
"engine": "postgresql",
17+
"schema": "query.sql",
18+
"queries": "query.sql",
19+
"strict_function_checks": true,
20+
"gen": {
21+
"go": {
22+
"package": "querytest_strict",
23+
"out": "go_strict"
24+
}
25+
}
1026
}
1127
]
1228
}

internal/sql/validate/func_call.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func (v *funcCallVisitor) Visit(node ast.Node) astutils.Visitor {
5656
}
5757
return nil
5858
}
59+
60+
// If we have sqlc.arg or sqlc.narg, there is no need to resolve the function call.
61+
// It won't resolve anyway, sinc it is not a real function.
62+
return nil
5963
}
6064

6165
fun, err := v.catalog.ResolveFuncCall(call)

0 commit comments

Comments
 (0)