Skip to content

Add pretty printing to more sql constructs #1850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 12 tasks
lovasoa opened this issue May 13, 2025 · 0 comments
Open
2 of 12 tasks

Add pretty printing to more sql constructs #1850

lovasoa opened this issue May 13, 2025 · 0 comments

Comments

@lovasoa
Copy link
Contributor

lovasoa commented May 13, 2025

This is a followup on #1847

Here are some constructs that are currently not handled by the pretty printer (they are displayed on a single line). I'm opening this to serve as a tracking issue to track implementation of these.

  • Format INSERT INTO with both VALUES and SELECT forms
  • Support UPDATE and DELETE with proper clause indentation
  • indent CREATE TABLE column definitions and constraints
  • Format CREATE VIEW and nested SELECT cleanly
  • Handle CREATE FUNCTION/PROCEDURE blocks with inner SQL formatting
  • format json_table and xmltable
  • Format BEGIN, COMMIT, ROLLBACK blocks clearly
  • Support control flow structures (IF, WHILE, LOOP) with block indentation
  • support multiline strings (the indentation should not be reflected inside the string)
  • Handle MERGE statements with WHEN MATCHED and WHEN NOT MATCHED branches
  • format CREATE INDEX with minimal structure
  • Handle EXPLAIN, EXPLAIN ANALYZE, and DESCRIBE statements

cc @alamb

lovasoa added a commit to lovasoa/sqlparser-rs that referenced this issue May 13, 2025
see apache#1850

all the tests are skipped at the moment, we will enable them as we implement more pretty printing
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

No branches or pull requests

1 participant