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
21 changes: 20 additions & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ example:

```sql
-- some query comment
SELECT name username, email,
SELECT name username, "email",
"weird-column-name"
FROM bar
```
Expand All @@ -96,6 +96,7 @@ config ideas:

- lower / upper case keywords (default lowercase)
- indent (default 2)
- quoted idents (default avoid)

links:

Expand Down Expand Up @@ -421,12 +422,30 @@ related: https://eslint.style/rules/no-extra-parens

should support various fixes so people can write in one dialect of SQL and have it easily convert to the other one

### Rule: group by all

[requires pg >=19](https://www.depesz.com/2025/10/02/waiting-for-postgresql-19-add-group-by-all/)

```sql
SELECT customer_id, merchant_id, request_id, count(*) from t
group by 1, 2, 3;
-- ^^^^^^^ implicit group by all
```

becomes:

```sql
SELECT customer_id, merchant_id, request_id, count(*) from t
group by all;
```

### Rule: unused column

```sql
SELECT customer_id, total_amount
FROM (
SELECT customer_id, SUM(amount) AS total_amount, min(created_at)
-- ^^^^^^^^^^^^^^^ unused
FROM orders
GROUP BY customer_id
) AS customer_totals
Expand Down
8 changes: 7 additions & 1 deletion crates/squawk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ Please open an issue at https://github.com/sbdchd/squawk/issues/new with the log
let opts = Opt::parse();

if opts.verbose {
// ANSI codes don't render properly in the VSCode output pane
let color_choice = if matches!(opts.cmd, Some(Command::Server)) {
simplelog::ColorChoice::Never
} else {
simplelog::ColorChoice::Auto
};
CombinedLogger::init(vec![simplelog::TermLogger::new(
simplelog::LevelFilter::Info,
simplelog::Config::default(),
simplelog::TerminalMode::Stderr,
simplelog::ColorChoice::Auto,
color_choice,
)])
.expect("problem creating logger");
}
Expand Down
Loading