Skip to content

Add pretty printing to more sql constructs #1850

Open
@lovasoa

Description

@lovasoa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions