From 64d28636c2d9559c212bfb5ff7228d831d2a7fc4 Mon Sep 17 00:00:00 2001 From: Andrew Benton Date: Wed, 20 Dec 2023 16:12:05 -0800 Subject: [PATCH 1/3] feat(analyzer): Implement parameter type annotations A first step towards implementing https://github.com/sqlc-dev/sqlc/issues/2800 --- internal/compiler/analyze.go | 13 ++-- internal/compiler/parse.go | 4 +- internal/compiler/resolve.go | 16 +++- .../testdata/param_type_annotations/db/db.go | 31 ++++++++ .../param_type_annotations/db/models.go | 14 ++++ .../param_type_annotations/db/query.sql.go | 74 +++++++++++++++++++ .../testdata/param_type_annotations/query.sql | 19 +++++ .../param_type_annotations/schema.sql | 1 + .../testdata/param_type_annotations/sqlc.yaml | 8 ++ internal/metadata/meta.go | 32 +++++++- internal/metadata/meta_test.go | 2 +- internal/sql/validate/param_ref.go | 18 ++--- 12 files changed, 206 insertions(+), 26 deletions(-) create mode 100644 internal/endtoend/testdata/param_type_annotations/db/db.go create mode 100644 internal/endtoend/testdata/param_type_annotations/db/models.go create mode 100644 internal/endtoend/testdata/param_type_annotations/db/query.sql.go create mode 100644 internal/endtoend/testdata/param_type_annotations/query.sql create mode 100644 internal/endtoend/testdata/param_type_annotations/schema.sql create mode 100644 internal/endtoend/testdata/param_type_annotations/sqlc.yaml diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go index 38d66fce19..3e38a9e80b 100644 --- a/internal/compiler/analyze.go +++ b/internal/compiler/analyze.go @@ -5,6 +5,7 @@ import ( analyzer "github.com/sqlc-dev/sqlc/internal/analysis" "github.com/sqlc-dev/sqlc/internal/config" + "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/named" @@ -106,15 +107,15 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { return prev } -func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string) (*analysis, error) { - return c._analyzeQuery(raw, query, true) +func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata) (*analysis, error) { + return c._analyzeQuery(raw, query, paramAnnotations, true) } -func (c *Compiler) inferQuery(raw *ast.RawStmt, query string) (*analysis, error) { - return c._analyzeQuery(raw, query, false) +func (c *Compiler) inferQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata) (*analysis, error) { + return c._analyzeQuery(raw, query, paramAnnotations, false) } -func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) (*analysis, error) { +func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata, failfast bool) (*analysis, error) { errors := make([]error, 0) check := func(err error) error { if failfast { @@ -173,7 +174,7 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) return nil, err } - params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds) + params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds, paramAnnotations) if err := check(err); err != nil { return nil, err } diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 022d23ea22..4311bfc86c 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -72,7 +72,7 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, var anlys *analysis if c.analyzer != nil { - inference, _ := c.inferQuery(raw, rawSQL) + inference, _ := c.inferQuery(raw, rawSQL, md.Params) if inference == nil { inference = &analysis{} } @@ -100,7 +100,7 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, // FOOTGUN: combineAnalysis mutates inference anlys = combineAnalysis(inference, result) } else { - anlys, err = c.analyzeQuery(raw, rawSQL) + anlys, err = c.analyzeQuery(raw, rawSQL, md.Params) if err != nil { return nil, err } diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index 1947558b25..a8441ad6d6 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -5,6 +5,7 @@ import ( "log/slog" "strconv" + "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" "github.com/sqlc-dev/sqlc/internal/sql/catalog" @@ -21,7 +22,7 @@ func dataType(n *ast.TypeName) string { } } -func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet) ([]Parameter, error) { +func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet, paramAnnotations map[string]metadata.ParamMetadata) ([]Parameter, error) { c := comp.catalog aliasMap := map[string]*ast.TableName{} @@ -619,5 +620,18 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, }) } } + + // Override the inferrerd type and nullability of annotated named params + for i, param := range a { + if param.Column.IsNamedParam { + if md, ok := paramAnnotations[param.Column.Name]; ok { + a[i].Column.DataType = md.DatabaseType + if md.ForceNotNull != nil { + a[i].Column.NotNull = *md.ForceNotNull + } + } + } + } + return a, nil } diff --git a/internal/endtoend/testdata/param_type_annotations/db/db.go b/internal/endtoend/testdata/param_type_annotations/db/db.go new file mode 100644 index 0000000000..e06d75a08b --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/db/db.go @@ -0,0 +1,31 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.24.0 + +package db + +import ( + "context" + "database/sql" +) + +type DBTX interface { + ExecContext(context.Context, string, ...interface{}) (sql.Result, error) + PrepareContext(context.Context, string) (*sql.Stmt, error) + QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) + QueryRowContext(context.Context, string, ...interface{}) *sql.Row +} + +func New(db DBTX) *Queries { + return &Queries{db: db} +} + +type Queries struct { + db DBTX +} + +func (q *Queries) WithTx(tx *sql.Tx) *Queries { + return &Queries{ + db: tx, + } +} diff --git a/internal/endtoend/testdata/param_type_annotations/db/models.go b/internal/endtoend/testdata/param_type_annotations/db/models.go new file mode 100644 index 0000000000..486912574f --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/db/models.go @@ -0,0 +1,14 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.24.0 + +package db + +import ( + "database/sql" +) + +type Test struct { + ID int32 + Name sql.NullString +} diff --git a/internal/endtoend/testdata/param_type_annotations/db/query.sql.go b/internal/endtoend/testdata/param_type_annotations/db/query.sql.go new file mode 100644 index 0000000000..c8d782d9c1 --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/db/query.sql.go @@ -0,0 +1,74 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.24.0 +// source: query.sql + +package db + +import ( + "context" + "database/sql" + "encoding/json" + + "github.com/google/uuid" +) + +const testAt = `-- name: TestAt :one +SELECT id, name FROM test WHERE name = $1 +` + +// @param foo integer +func (q *Queries) TestAt(ctx context.Context, foo sql.NullInt32) (Test, error) { + row := q.db.QueryRowContext(ctx, testAt, foo) + var i Test + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const testForceNotNull = `-- name: TestForceNotNull :one +SELECT id, name FROM test WHERE name = $1 +` + +// @param foo! jsonb +func (q *Queries) TestForceNotNull(ctx context.Context, foo json.RawMessage) (Test, error) { + row := q.db.QueryRowContext(ctx, testForceNotNull, foo) + var i Test + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const testForceNullable = `-- name: TestForceNullable :one +SELECT id, name FROM test WHERE id = $1 +` + +// @param foo? uuid +func (q *Queries) TestForceNullable(ctx context.Context, foo uuid.NullUUID) (Test, error) { + row := q.db.QueryRowContext(ctx, testForceNullable, foo) + var i Test + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const testGibberish = `-- name: TestGibberish :one +SELECT id, name FROM test WHERE id = $1 +` + +// @param foo? uuid sdfagyi +func (q *Queries) TestGibberish(ctx context.Context, foo interface{}) (Test, error) { + row := q.db.QueryRowContext(ctx, testGibberish, foo) + var i Test + err := row.Scan(&i.ID, &i.Name) + return i, err +} + +const testSqlcArg = `-- name: TestSqlcArg :one +SELECT id, name FROM test WHERE id = $1 +` + +// @param foo text +func (q *Queries) TestSqlcArg(ctx context.Context, foo string) (Test, error) { + row := q.db.QueryRowContext(ctx, testSqlcArg, foo) + var i Test + err := row.Scan(&i.ID, &i.Name) + return i, err +} diff --git a/internal/endtoend/testdata/param_type_annotations/query.sql b/internal/endtoend/testdata/param_type_annotations/query.sql new file mode 100644 index 0000000000..9b6c6d2cf7 --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/query.sql @@ -0,0 +1,19 @@ +-- name: TestSqlcArg :one +-- @param foo text +SELECT * FROM test WHERE id = sqlc.arg('foo'); + +-- name: TestAt :one +-- @param foo integer +SELECT * FROM test WHERE name = @foo; + +-- name: TestForceNotNull :one +-- @param foo! jsonb +SELECT * FROM test WHERE name = @foo; + +-- name: TestForceNullable :one +-- @param foo? uuid +SELECT * FROM test WHERE id = @foo; + +-- name: TestGibberish :one +-- @param foo? uuid sdfagyi +SELECT * FROM test WHERE id = @foo; diff --git a/internal/endtoend/testdata/param_type_annotations/schema.sql b/internal/endtoend/testdata/param_type_annotations/schema.sql new file mode 100644 index 0000000000..86cd4f6c32 --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/schema.sql @@ -0,0 +1 @@ +CREATE TABLE test (id INTEGER NOT NULL, name TEXT); diff --git a/internal/endtoend/testdata/param_type_annotations/sqlc.yaml b/internal/endtoend/testdata/param_type_annotations/sqlc.yaml new file mode 100644 index 0000000000..62e6cdcfbf --- /dev/null +++ b/internal/endtoend/testdata/param_type_annotations/sqlc.yaml @@ -0,0 +1,8 @@ +version: "2" +sql: +- schema: schema.sql + queries: query.sql + engine: postgresql + gen: + go: + out: db diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index 97ff36dbd2..d099742027 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -15,7 +15,7 @@ type Metadata struct { Name string Cmd string Comments []string - Params map[string]string + Params map[string]ParamMetadata Flags map[string]bool Filename string @@ -34,6 +34,12 @@ const ( CmdBatchOne = ":batchone" ) +type ParamMetadata struct { + DatabaseType string + // unset => nil, "!" => true, "?" => false + ForceNotNull *bool +} + // A query name must be a valid Go identifier // // https://golang.org/ref/spec#Identifiers @@ -113,8 +119,8 @@ func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string return "", "", nil } -func ParseParamsAndFlags(comments []string) (map[string]string, map[string]bool, error) { - params := make(map[string]string) +func ParseParamsAndFlags(comments []string) (map[string]ParamMetadata, map[string]bool, error) { + params := make(map[string]ParamMetadata) flags := make(map[string]bool) for _, line := range comments { @@ -137,7 +143,25 @@ func ParseParamsAndFlags(comments []string) (map[string]string, map[string]bool, paramToken := s.Text() rest = append(rest, paramToken) } - params[name] = strings.Join(rest, " ") + var hasSuffix, suffixValue bool + switch name[len(name)-1] { + case '!': + name = name[:len(name)-1] + hasSuffix = true + suffixValue = true + case '?': + name = name[:len(name)-1] + hasSuffix = true + suffixValue = false + } + var forceNotNull *bool + if hasSuffix { + forceNotNull = &suffixValue + } + params[name] = ParamMetadata{ + DatabaseType: strings.Join(rest, " "), + ForceNotNull: forceNotNull, + } default: flags[token] = true } diff --git a/internal/metadata/meta_test.go b/internal/metadata/meta_test.go index 3c2be6d6de..e675cb45f4 100644 --- a/internal/metadata/meta_test.go +++ b/internal/metadata/meta_test.go @@ -87,7 +87,7 @@ func TestParseQueryParams(t *testing.T) { t.Errorf("expected param not found") } - if pt != "UUID" { + if pt.DatabaseType != "UUID" { t.Error("unexpected param metadata:", pt) } diff --git a/internal/sql/validate/param_ref.go b/internal/sql/validate/param_ref.go index ab9413f40f..21f07dfc81 100644 --- a/internal/sql/validate/param_ref.go +++ b/internal/sql/validate/param_ref.go @@ -10,32 +10,26 @@ import ( ) func ParamRef(n ast.Node) (map[int]bool, bool, error) { - var allrefs []*ast.ParamRef - var dollar bool - var nodollar bool + seen := map[int]bool{} + var dollar, nodollar bool // Find all parameter references astutils.Walk(astutils.VisitorFunc(func(node ast.Node) { switch n := node.(type) { case *ast.ParamRef: - ref := node.(*ast.ParamRef) - if ref.Dollar { + if n.Dollar { dollar = true } else { nodollar = true } - allrefs = append(allrefs, n) + if n.Number > 0 { + seen[n.Number] = true + } } }), n) if dollar && nodollar { return nil, false, errors.New("can not mix $1 format with ? format") } - seen := map[int]bool{} - for _, r := range allrefs { - if r.Number > 0 { - seen[r.Number] = true - } - } for i := 1; i <= len(seen); i += 1 { if _, ok := seen[i]; !ok { return seen, !nodollar, &sqlerr.Error{ From c5c6a7a0acb4c9db1eec6886b44db4e6b96ff86f Mon Sep 17 00:00:00 2001 From: Andrew Benton Date: Wed, 20 Dec 2023 22:50:41 -0800 Subject: [PATCH 2/3] Better implementation --- internal/compiler/analyze.go | 13 ++++++------- internal/compiler/parse.go | 20 ++++++++++++++++++-- internal/compiler/resolve.go | 16 +--------------- internal/metadata/meta.go | 31 ++++++++++++++++--------------- 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/internal/compiler/analyze.go b/internal/compiler/analyze.go index 3e38a9e80b..38d66fce19 100644 --- a/internal/compiler/analyze.go +++ b/internal/compiler/analyze.go @@ -5,7 +5,6 @@ import ( analyzer "github.com/sqlc-dev/sqlc/internal/analysis" "github.com/sqlc-dev/sqlc/internal/config" - "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/source" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/named" @@ -107,15 +106,15 @@ func combineAnalysis(prev *analysis, a *analyzer.Analysis) *analysis { return prev } -func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata) (*analysis, error) { - return c._analyzeQuery(raw, query, paramAnnotations, true) +func (c *Compiler) analyzeQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, true) } -func (c *Compiler) inferQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata) (*analysis, error) { - return c._analyzeQuery(raw, query, paramAnnotations, false) +func (c *Compiler) inferQuery(raw *ast.RawStmt, query string) (*analysis, error) { + return c._analyzeQuery(raw, query, false) } -func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, paramAnnotations map[string]metadata.ParamMetadata, failfast bool) (*analysis, error) { +func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, failfast bool) (*analysis, error) { errors := make([]error, 0) check := func(err error) error { if failfast { @@ -174,7 +173,7 @@ func (c *Compiler) _analyzeQuery(raw *ast.RawStmt, query string, paramAnnotation return nil, err } - params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds, paramAnnotations) + params, err := c.resolveCatalogRefs(qc, rvs, refs, namedParams, embeds) if err := check(err); err != nil { return nil, err } diff --git a/internal/compiler/parse.go b/internal/compiler/parse.go index 4311bfc86c..99d3fcbff6 100644 --- a/internal/compiler/parse.go +++ b/internal/compiler/parse.go @@ -72,7 +72,7 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, var anlys *analysis if c.analyzer != nil { - inference, _ := c.inferQuery(raw, rawSQL, md.Params) + inference, _ := c.inferQuery(raw, rawSQL) if inference == nil { inference = &analysis{} } @@ -100,12 +100,28 @@ func (c *Compiler) parseQuery(stmt ast.Node, src string, o opts.Parser) (*Query, // FOOTGUN: combineAnalysis mutates inference anlys = combineAnalysis(inference, result) } else { - anlys, err = c.analyzeQuery(raw, rawSQL, md.Params) + anlys, err = c.analyzeQuery(raw, rawSQL) if err != nil { return nil, err } } + // Override the inferrerd type and nullability of annotated named params + for i, param := range anlys.Parameters { + if !param.Column.IsNamedParam { + continue + } + if paramMetadata, ok := md.Params[param.Column.Name]; ok { + anlys.Parameters[i].Column.DataType = paramMetadata.DatabaseType + switch paramMetadata.Nullability { + case metadata.ParamNullabilityForceNotNull: + anlys.Parameters[i].Column.NotNull = true + case metadata.ParamNullabilityForceNullable: + anlys.Parameters[i].Column.NotNull = false + } + } + } + expanded := anlys.Query // If the query string was edited, make sure the syntax is valid diff --git a/internal/compiler/resolve.go b/internal/compiler/resolve.go index a8441ad6d6..1947558b25 100644 --- a/internal/compiler/resolve.go +++ b/internal/compiler/resolve.go @@ -5,7 +5,6 @@ import ( "log/slog" "strconv" - "github.com/sqlc-dev/sqlc/internal/metadata" "github.com/sqlc-dev/sqlc/internal/sql/ast" "github.com/sqlc-dev/sqlc/internal/sql/astutils" "github.com/sqlc-dev/sqlc/internal/sql/catalog" @@ -22,7 +21,7 @@ func dataType(n *ast.TypeName) string { } } -func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet, paramAnnotations map[string]metadata.ParamMetadata) ([]Parameter, error) { +func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, args []paramRef, params *named.ParamSet, embeds rewrite.EmbedSet) ([]Parameter, error) { c := comp.catalog aliasMap := map[string]*ast.TableName{} @@ -620,18 +619,5 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar, }) } } - - // Override the inferrerd type and nullability of annotated named params - for i, param := range a { - if param.Column.IsNamedParam { - if md, ok := paramAnnotations[param.Column.Name]; ok { - a[i].Column.DataType = md.DatabaseType - if md.ForceNotNull != nil { - a[i].Column.NotNull = *md.ForceNotNull - } - } - } - } - return a, nil } diff --git a/internal/metadata/meta.go b/internal/metadata/meta.go index d099742027..6dfd889d2c 100644 --- a/internal/metadata/meta.go +++ b/internal/metadata/meta.go @@ -36,10 +36,17 @@ const ( type ParamMetadata struct { DatabaseType string - // unset => nil, "!" => true, "?" => false - ForceNotNull *bool + Nullability ParamNullability } +type ParamNullability int + +const ( + ParamNullabilityUnspecified ParamNullability = iota // "" + ParamNullabilityForceNotNull // "!" + ParamNullabilityForceNullable // "?" +) + // A query name must be a valid Go identifier // // https://golang.org/ref/spec#Identifiers @@ -143,24 +150,18 @@ func ParseParamsAndFlags(comments []string) (map[string]ParamMetadata, map[strin paramToken := s.Text() rest = append(rest, paramToken) } - var hasSuffix, suffixValue bool - switch name[len(name)-1] { - case '!': + var nullability ParamNullability + switch { + case strings.HasSuffix(name, "!"): name = name[:len(name)-1] - hasSuffix = true - suffixValue = true - case '?': + nullability = ParamNullabilityForceNotNull + case strings.HasSuffix(name, "?"): name = name[:len(name)-1] - hasSuffix = true - suffixValue = false - } - var forceNotNull *bool - if hasSuffix { - forceNotNull = &suffixValue + nullability = ParamNullabilityForceNullable } params[name] = ParamMetadata{ DatabaseType: strings.Join(rest, " "), - ForceNotNull: forceNotNull, + Nullability: nullability, } default: flags[token] = true From 1ab10e124728b7df8cda30633820c0bf4296d50e Mon Sep 17 00:00:00 2001 From: Andrew Benton Date: Wed, 20 Dec 2023 22:54:13 -0800 Subject: [PATCH 3/3] Better test --- .../endtoend/testdata/param_type_annotations/db/query.sql.go | 5 ++--- internal/endtoend/testdata/param_type_annotations/query.sql | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/endtoend/testdata/param_type_annotations/db/query.sql.go b/internal/endtoend/testdata/param_type_annotations/db/query.sql.go index c8d782d9c1..c94698dd4a 100644 --- a/internal/endtoend/testdata/param_type_annotations/db/query.sql.go +++ b/internal/endtoend/testdata/param_type_annotations/db/query.sql.go @@ -8,7 +8,6 @@ package db import ( "context" "database/sql" - "encoding/json" "github.com/google/uuid" ) @@ -29,8 +28,8 @@ const testForceNotNull = `-- name: TestForceNotNull :one SELECT id, name FROM test WHERE name = $1 ` -// @param foo! jsonb -func (q *Queries) TestForceNotNull(ctx context.Context, foo json.RawMessage) (Test, error) { +// @param foo! uuid +func (q *Queries) TestForceNotNull(ctx context.Context, foo uuid.UUID) (Test, error) { row := q.db.QueryRowContext(ctx, testForceNotNull, foo) var i Test err := row.Scan(&i.ID, &i.Name) diff --git a/internal/endtoend/testdata/param_type_annotations/query.sql b/internal/endtoend/testdata/param_type_annotations/query.sql index 9b6c6d2cf7..75355708a6 100644 --- a/internal/endtoend/testdata/param_type_annotations/query.sql +++ b/internal/endtoend/testdata/param_type_annotations/query.sql @@ -7,7 +7,7 @@ SELECT * FROM test WHERE id = sqlc.arg('foo'); SELECT * FROM test WHERE name = @foo; -- name: TestForceNotNull :one --- @param foo! jsonb +-- @param foo! uuid SELECT * FROM test WHERE name = @foo; -- name: TestForceNullable :one