Repository navigation
Conversation
CoalesceExpr and MinMaxExpr emit their argument list without a soft break after the opening parenthesis and without an indent region, unlike emit_standard_function. When the enclosing group breaks, the only break opportunity left is the one before a leading comma, so continuation arguments land at the same indentation as the line that opens the call. Mirror emit_standard_function: soft break after L_PAREN, indent region around the arguments, soft break before R_PAREN. A list that fits keeps rendering on a single line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
COALESCEandGREATEST/LEASTare rendered by theCoalesceExprandMinMaxExprnodes, which emit their argument list without the soft break after the opening parenthesis and without the indent region thatemit_standard_functionwraps around the arguments of a regular function call.When the group breaks, the only remaining break opportunity is the one before a leading comma, so wrapped arguments land at the same indentation as the line that opens the call:
A regular function call in the same position already renders correctly.
Fix
Mirror
emit_standard_functioninemit_coalesce_exprandemit_min_max_expr: soft break afterL_PAREN, indent region around the arguments, soft break beforeR_PAREN. A list that fits keeps rendering on a single line.Tests
coalesce_expr_1.sqlandmin_max_expr_1.sql(leading commas, tabs, expanded layout) pin the broken rendering;window_function_group_200andopr_sanity_80are updated: they only move the affectedCOALESCE/greatestcalls to the new layout;pgls_pretty_printsuite passes (566 tests),cargo clippy --all-targetsclean.