-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
Problem
The formatter (pkg/formatter/render.go) is missing render handlers for several statement types, which causes round-trip failures: you can parse these statements but cannot format them back to SQL.
Missing Handlers
| Statement Type | Dialect | Impact |
|---|---|---|
CreateSequenceStatement |
PostgreSQL, Oracle, MariaDB (v1.14.0) | Cannot format sequence DDL |
AlterSequenceStatement |
PostgreSQL, Oracle, MariaDB | Cannot format sequence modifications |
DropSequenceStatement |
PostgreSQL, Oracle, MariaDB | Cannot format sequence drops |
ShowStatement |
MySQL, MariaDB, ClickHouse | Cannot format SHOW DATABASES/TABLES/CREATE |
DescribeStatement |
MySQL, MariaDB, PostgreSQL (\d) | Cannot format DESCRIBE/\d table |
Impact
Parse → transform → format workflows fail silently (returns empty string or error) for:
CREATE SEQUENCE order_id START 1 INCREMENT 1 MINVALUE 1 MAXVALUE 9999999 CACHE 10;
ALTER SEQUENCE order_id RESTART WITH 100;
DROP SEQUENCE IF EXISTS order_id;
SHOW TABLES LIKE 'user%';
DESCRIBE users;Implementation
Add to pkg/formatter/render.go:
case *ast.CreateSequenceStatement:
return r.renderCreateSequence(stmt)
case *ast.AlterSequenceStatement:
return r.renderAlterSequence(stmt)
case *ast.DropSequenceStatement:
return r.renderDropSequence(stmt)
case *ast.ShowStatement:
return r.renderShow(stmt)
case *ast.DescribeStatement:
return r.renderDescribe(stmt)Acceptance Criteria
-
CreateSequenceStatementrenders correctly (all options: START, INCREMENT, MINVALUE, MAXVALUE, CACHE, CYCLE/NO CYCLE) -
AlterSequenceStatementrenders correctly -
DropSequenceStatementrenders correctly (with IF EXISTS) -
ShowStatementrenders correctly for all variants (SHOW TABLES, SHOW DATABASES, SHOW CREATE TABLE, SHOW PROCESSLIST) -
DescribeStatementrenders correctly - Round-trip test: parse → format → parse → compare ASTs (identity)
- Keyword casing respects formatter options
- Tests for all new handlers: 5+ per statement type
Reactions are currently unavailable