# PgTidy house style — all fields with their default values. # Place as .pgtidy.yaml in your project root (or any parent directory). # Any field you omit keeps its default. # --- Core --- indent: " " # One indentation level (two spaces). newline: "\n" # Line terminator emitted by the formatter. # --- Casing --- # upper | lower | preserve keyword_case: upper # SQL keywords (SELECT, FROM, WHERE, …) ident_case: lower # Unquoted identifiers (column/variable names) type_case: lower # Built-in type names (text, integer, boolean, …) alias_case: lower # Token immediately following AS in SELECT / FROM builtin_case: lower # Built-in function names (COALESCE, MAX, NOW, …) custom_type_case: lower # User-defined / domain types not in the built-in set # --- Query layout --- commas: leading # leading → ,col | trailing → col, align_columns: false # Pad SELECT list items so values align vertically align_line_comments: false # Align trailing -- comments within a block select_align_as: false # Pad between expression and AS keyword in SELECT list set_align_equal: false # Align = in UPDATE SET list indent_join: false # Extra indentation for JOIN … ON lines join_indent_size: 1 # Number of extra indent levels for JOINs # always | when_long | never where_wrap: always # Each AND/OR condition on its own line where_and_or_indent: true # AND/OR indented one level under WHERE # --- Subqueries --- # same_line | new_line subquery_opening: same_line # Opening ( placement subquery_content: new_line # Content indentation inside parens subquery_closing: new_line # Closing ) placement subquery_space_before_paren: false # Space before ( in subqueries # --- INSERT --- insert_collapse_values: true # Fold multiple VALUES rows onto fewer lines # --- Routines (functions / procedures) --- align_param_types: true # Pad param names so type column aligns across all params routine_as_wrap: true # Newline before AS $$ (false = keep AS on same line) # --- PL/pgSQL body --- plpgsql_max_blank_lines: 1 # Max consecutive blank lines in body plpgsql_declare_align_type: false # Align type column in DECLARE block plpgsql_declare_align_eq: false # Align := / = in DECLARE block plpgsql_if_then_newline: true # THEN on its own line (false = same line as condition) plpgsql_loop_collapse: true # Collapse empty loop bodies to one line # --- Expressions --- binary_op_align: false # Align =, <>, || etc. vertically in WHERE/expression lists space_after_comma_in_calls: false # Space after , in function calls: func(a, b) case_when_wrap: false # Each WHEN … THEN on its own line case_end: new_line # END placement: same_line | new_line case_collapse: false # Collapse short CASE expressions to one line record_space_before_paren: false # Space before ( in ROW(…) / record constructors