darold / darold/pgFormatter

Bad indentation with nested array syntax

Open
#273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PLpgSQL
Stars
2k
Forks
121
Avg merge
4d 21h
Merged PRs (30d)
7

Description

No idea why the indentation is off by 1 at the end of this query

pg_format << EOF
select t1.a, 
       (array (select (b, array (select b from t2)) from t2)) from t1
EOF
SELECT
    t1.a,
    (ARRAY (
            SELECT
                (b,
                    ARRAY (
                        SELECT
                            b
                        FROM
                            t2))
                FROM
                    t2))
    FROM
        t1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the nested-array example with the pg_format command shown in the issue and compare its output with the reported indentation. Trace the formatter entry point responsible for nested SELECT and ARRAY formatting, then add or update a regression case for this query. Done means the query's nested clauses are indented consistently without changing other formatting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql
Domain
databases, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.