Skip to content

fix: pin SQLQuack 804864d2 and format CTE-body placeholders - #44

Merged
kvlonge merged 2 commits into
mainfrom
fix/sqlquack-804864d2
Nov 9, 2026
Merged

kvlonge merged 2 commits into
mainfrom
fix/sqlquack-804864d2

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

SQLBuild's cutover pins SQLQuack 804864d2. SQLClean must pin the same rev, or a build using both gets two copies of SQLQuack. That rev also brings formatter fixes, and DuckShop needs SQLClean to format a placeholder that stands for a whole CTE query.

Changes

  • Pin every SQLQuack crate to 804864d2.
  • Format AS (<placeholder>) CTE bodies: write SELECT before the placeholder, lay out, take it out again, and check every token.
  • SQLQuack now fingerprints BigQuery and SQL Server with their own tokenizers and keyword lists, so their fingerprints change once (SQLClean 0.6.0 used generic tokens). Other dialects are unchanged. SQLBuild's cutover release carries the upgrade note for stored fingerprints.
  • Update the SQL Server golden row, [o] now being one token, from f1525ee2 to f4fac3ed, which SQLBuild 0.204.0 stores for that row. It is the only golden row that changed: the BigQuery, Snowflake, DuckDB, PostgreSQL, Databricks and generic rows are identical. (BigQuery's golden statement happens to hash the same; other BigQuery statements change.)

Verification

  • make verify: fensu 0 faults; cargo 40 + 8 passed; pytest 72 passed.
  • Cargo.lock has one SQLQuack commit and no polyglot. Native lint runs on postgres, generic and sqlite.
  • DuckShop's captured format requests format, including both @py CTE bodies.

BEGIN_COMMIT_OVERRIDE
fix(format): lay out a placeholder that stands for a CTE's whole query
fix(format): lay out T-SQL variable assignments, named EXEC arguments and DECLARE defaults
fix(format): lay out Snowflake paths after a qualified column spelled like a keyword, such as s.body:ts
fix: fingerprint BigQuery and SQL Server with their own tokenizers, so keyword case no longer changes them; their fingerprints change once
build(deps): pin SQLQuack 804864d2
END_COMMIT_OVERRIDE

A host writes one interpolation placeholder for a macro that expands to a
whole query, as in `headers AS (__sqlclean_interpolation_6__)`. SQLQuack
cannot parse a bare name as a query, so the file was declined. The
formatter now writes `SELECT ` before such a placeholder, lays the SQL out,
and takes the `SELECT` back out, checking that every token is unchanged. A
SELECT the author wrote before a placeholder is kept.
Every SQLQuack crate moves to the same rev the SQLBuild cutover pins, so a
build that uses both has one copy of SQLQuack.

SQLQuack now fingerprints SQL Server with its own tokenizer, so a bracketed
name such as `[o]` is one token. The fingerprint of a SQL Server query with
bracketed names changes once from SQLClean 0.5.0 and 0.6.0, back to the value
SQLBuild 0.204.0 stores: the golden row moves from f1525ee2 to f4fac3ed.
Every other golden fingerprint is unchanged.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sqlclean with  Cloudflare Pages  Cloudflare Pages

Latest commit: b55cb1b
Status: ✅  Deploy successful!
Preview URL: https://0e8f2e53.sqlclean.pages.dev
Branch Preview URL: https://fix-sqlquack-804864d2.sqlclean.pages.dev

View logs

@kvlonge
kvlonge merged commit a3c081f into main Nov 9, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant