Skip to content

Add beautify format for ALTER ROLE and CREATE ROLE SETTINGS#256

Merged
git-hulk merged 3 commits intomasterfrom
copilot/add-beautify-format-alter-role
Feb 14, 2026
Merged

Add beautify format for ALTER ROLE and CREATE ROLE SETTINGS#256
git-hulk merged 3 commits intomasterfrom
copilot/add-beautify-format-alter-role

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

ALTER ROLE statements with SETTINGS clauses were not respecting beautify mode, rendering all settings inline instead of multi-line.

Changes

  • AlterRole.FormatSQL() - Use formatter.Break() before SETTINGS keyword and indent each setting clause
  • RoleSetting.FormatSQL() - Replace whitespace separators with formatter.Break() to separate setting components (value, MIN, MAX, modifiers) onto individual lines
  • CreateRole.FormatSQL() - Apply same pattern for consistency

Example

Before:

ALTER ROLE r3_01293 SETTINGS max_memory_usage=5000000 MIN 4000000 MAX 6000000 WRITABLE;

After (beautified):

ALTER ROLE r3_01293
SETTINGS
  max_memory_usage=5000000
  MIN 4000000
  MAX 6000000
  WRITABLE;

Compact mode output remains unchanged.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support of the beautify format for ALTER ROLE</issue_title>
<issue_description>The current format is:

ALTER ROLE r3_01293 SETTINGS max_memory_usage=5000000 MIN 4000000 MAX 6000000 WRITABLE;

Expected to be:

ALTER ROLE r3_01293
SETTINGS
  max_memory_usage=5000000
  MIN 4000000
  MAX 6000000
  WRITABLE;
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 13, 2026 09:11
Co-authored-by: git-hulk <4987594+git-hulk@users.noreply.github.com>
Co-authored-by: git-hulk <4987594+git-hulk@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for beautify format in ALTER ROLE Add beautify format for ALTER ROLE and CREATE ROLE SETTINGS Feb 13, 2026
Copilot AI requested a review from git-hulk February 13, 2026 09:16
@git-hulk git-hulk marked this pull request as ready for review February 14, 2026 04:26
Copilot AI review requested due to automatic review settings February 14, 2026 04:26
@coveralls
Copy link

Pull Request Test Coverage Report for Build 21981225862

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 51.387%

Totals Coverage Status
Change from base Build 21981030298: 0.03%
Covered Lines: 8152
Relevant Lines: 15864

💛 - Coveralls

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes ClickHouse SQL beautify formatting for ALTER ROLE and CREATE ROLE statements that include SETTINGS, ensuring settings are rendered on multiple lines (with indentation) in beautify mode while keeping compact formatting unchanged.

Changes:

  • Update AlterRole.FormatSQL() and CreateRole.FormatSQL() to Break() before SETTINGS, indent the settings list, and break between items.
  • Update RoleSetting.FormatSQL() to use formatter.Break() between setting components (pairs/modifier) so multi-part settings become multi-line in beautify mode.
  • Refresh beautify golden fixtures for alter_role.sql and create_role.sql to match the new output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
parser/format.go Implements beautify-aware line breaking/indentation for role SETTINGS clauses and multi-part RoleSetting rendering.
parser/testdata/ddl/format/beautify/create_role.sql Updates beautify golden output to reflect multi-line SETTINGS formatting for CREATE ROLE.
parser/testdata/ddl/format/beautify/alter_role.sql Updates beautify golden output to reflect multi-line SETTINGS formatting for ALTER ROLE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@git-hulk git-hulk merged commit f029f90 into master Feb 14, 2026
10 checks passed
git-hulk added a commit that referenced this pull request Feb 14, 2026
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: git-hulk <4987594+git-hulk@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

Add support of the beautify format for ALTER ROLE

3 participants