Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/cmd/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ func Format(ctx context.Context, dir, filename string, o *Options) (map[string]s
continue
}
// File-level belt for the reprinter path: no formatting result may
// change the file's comments. A violation is a formatter bug; keep
// the file as written and say so.
// change the file's comments or its statement count. A violation is
// a formatter bug; keep the file as written and say so.
before, err1 := f.ParseFile(strings.NewReader(string(contents)))
after, err2 := f.ParseFile(strings.NewReader(formatted))
if err1 == nil && (err2 != nil || !sameComments(before.Comments, after.Comments)) {
fmt.Fprintf(stderr, "%s: skipped: formatting would alter comments (this is a bug in sqlc fmt)\n", rel)
if err1 == nil && (err2 != nil || len(before.Stmts) != len(after.Stmts) || !sameComments(before.Comments, after.Comments)) {
fmt.Fprintf(stderr, "%s: skipped: formatting would alter the file (this is a bug in sqlc fmt)\n", rel)
continue
}
output[file] = formatted
Expand Down
2 changes: 1 addition & 1 deletion internal/compiler/output_columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func isTableRequired(n ast.Node, col *Column, prior int) int {
return helper(tableOptional, tableRequired)
case ast.JoinTypeFull:
return helper(tableOptional, tableOptional)
case ast.JoinTypeInner:
case ast.JoinTypeInner, ast.JoinTypeCross, ast.JoinTypeComma:
return helper(tableRequired, tableRequired)
}
case *ast.List:
Expand Down
18 changes: 9 additions & 9 deletions internal/endtoend/testdata/between_args/sqlite/go/query.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions internal/endtoend/testdata/between_args/sqlite/query.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-- name: GetBetweenPrices :many
SELECT *
FROM products
WHERE price BETWEEN ? AND ?;
SELECT *
FROM products
WHERE price BETWEEN ? AND ?;

-- name: GetBetweenPricesTable :many
SELECT *
FROM products
WHERE products.price BETWEEN ? AND ?;
SELECT *
FROM products
WHERE products.price BETWEEN ? AND ?;

-- name: GetBetweenPricesTableAlias :many
SELECT *
FROM products as p
WHERE p.price BETWEEN ? AND ?;
SELECT *
FROM products AS p
WHERE p.price BETWEEN ? AND ?;
58 changes: 29 additions & 29 deletions internal/endtoend/testdata/builtins/sqlite/go/mathfunc.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading