Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sqlc-dev/sqlc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: sqlc-dev/sqlc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: claude/sqlc-fmt-verify-diffs-mm7022
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 25 files changed
  • 1 contributor

Commits on Aug 28, 2026

  1. Add sqlc fmt verification report against endtoend corpus

    Run sqlc fmt across all 800 PostgreSQL/MySQL endtoend configs and verify
    each result three ways: regenerate and compare code with embedded SQL
    stripped (AST-based), and for MySQL compare canonical parse trees of the
    original and formatted queries with identifier case preserved.
    
    21 configs need fixes, reducing to six root causes: PostgreSQL prints
    @name params as '@ name' (dropping them from codegen); the dolphin
    printer folds identifier case, corrupts literals (NULL -> '', 1.0 -> 0),
    drops DISTINCT / UNION ORDER BY / GROUP_CONCAT ORDER BY / optimizer
    hints / UPDATE JOIN ON clauses and SET qualifiers, loses DDL type
    attributes, and prints SHOW WARNINGS as its internal SELECT form.
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01UZBvADuHMZEjoF551NccgP
    claude committed Aug 28, 2026
    Configuration menu
    Copy the full SHA
    129516c View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2026

  1. Fix sqlc fmt corruption in PostgreSQL and MySQL formatters

    Fix the six root causes found by running sqlc fmt across the endtoend
    corpus (see fmt-verify/README.md):
    
    PostgreSQL: a named parameter with a cast (@name::type) printed as
    '@ name::type' because the cast binds tighter than the @ operator, so the
    printer saw a prefix operator and added a space — silently dropping the
    parameter from generated code. Prefix sigils now glue to operands that
    start with an identifier.
    
    MySQL (dolphin): the formatter reprinted from the compiler's normalized
    AST, which loses information the compiler doesn't need but a formatter
    must keep. sqlc fmt now uses a format parser that preserves identifier
    case (table names are case-sensitive on most servers), and the converter
    keeps what it used to drop:
    
    - NULL, TRUE/FALSE, and decimal literals convert by datum kind, so
      NULL no longer prints as '', 1.0 as 0, or true as 1. This also fixes
      type inference: a bool literal column is now bool, not int32
      (selectstatic golden regenerated).
    - SELECT DISTINCT keeps its DISTINCT.
    - The ORDER BY of a compound (UNION) statement survives.
    - GROUP_CONCAT(... ORDER BY ...) keeps its ordering.
    - Optimizer hints (/*+ ... */) are carried through to printing.
    - Multi-table UPDATE keeps its JOIN's ON condition and the table
      qualifiers in SET.
    - DECIMAL(p,s) precision and UNSIGNED survive in column definitions.
    
    Backstop: dolphin now implements Fingerprint (via marino's restore with
    identifier case preserved and redundant parens unwrapped), giving MySQL
    the same proof PostgreSQL has: fmt accepts a formatted statement only
    when it provably means what the author wrote, and otherwise leaves the
    statement exactly as written. That is what fixes SHOW WARNINGS, which
    the parser rewrites into a synthetic SELECT for analysis: it now falls
    back to the original text instead of printing the internal form.
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01UZBvADuHMZEjoF551NccgP
    claude committed Aug 29, 2026
    Configuration menu
    Copy the full SHA
    2ec054c View commit details
    Browse the repository at this point in the history
  2. Note in fmt-verify report that all six root causes are fixed

    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01UZBvADuHMZEjoF551NccgP
    claude committed Aug 29, 2026
    Configuration menu
    Copy the full SHA
    145a60a View commit details
    Browse the repository at this point in the history
Loading