Repository navigation
Commit dc51324
committed
preprocess: cover every sqlc syntax shape used in internal/endtoend
Audited every .sql file in internal/endtoend (and examples/), grouping
each sqlc.* call by engine, function and argument shape, then diffed that
inventory against the preprocessor's testdata. Seventeen shapes the corpus
relies on had no golden. They all behaved correctly; they just were not
pinned.
The ones that exercise a distinct code path:
- MySQL reads "x" as a string, so a double-quoted argument names the
parameter and keeps its case, unlike a bare reference which is folded
(coalesce_params/mysql, overrides_go_types/mysql)
- $1 is not a placeholder in MySQL and is left alone
(create_view/mysql)
- "-- @sqlc-vet-disable" is a vet directive in a PostgreSQL query file,
where @name *is* sqlc syntax; it survives only because the lexer never
looks inside a comment (vet_disable)
- PostgreSQL's @> operator next to a string holding a $-path, with a
cast on the argument (table_function/postgresql)
The rest fill in per-engine shapes: string-constant arguments for narg and
slice on PostgreSQL and SQLite, narg against a bare reference on MySQL and
SQLite, and the four invalid-call errors on MySQL and SQLite, where the
reported text is dialect-specific ('got "?"' rather than 'got "$1"').
Also adds cases for the string-constant forms that had only one golden
between them: case preservation against a folded bare reference, an
escaped quote inside the name, and sqlc.embed('t').
76 cases in total. Every sqlc syntax shape in the corpus now has a
preprocessor test for its engine.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015BSM9xGoosq58r1Mz6B7YP1 parent 7fcad42 commit dc51324
54 files changed
Lines changed: 457 additions & 0 deletions
File tree
- internal/sql/preprocess
- testdata
- mysql
- dollar_number_is_not_a_placeholder
- double_quoted_argument
- error_invalid_calls
- narg_identifier
- slice_folds_identifier
- string_constant_keeps_case
- string_constant
- postgresql
- at_sign_in_vet_directive
- embed_string_constant
- jsonb_operator_and_path_string
- narg_string_constant
- slice_string_constant
- string_constant_escaped_quote
- string_constant_keeps_case
- sqlite
- error_invalid_calls
- narg_identifier
- string_constant
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments