8000 Wrapping queries with parantheses causes de-indentation · Issue #362 · darold/pgFormatter · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Wrapping queries with parantheses causes de-indentation #362
Open
@birgersp

Description

@birgersp

Hello,

Here is an example

create function foobar()
    returns table(
        "n" integer
    )
    as $$
begin
    if "_a" then
        if "_b" then
            if "_c" then
                return query
                select
                    1
                union all
                select
                    1
                union all
                select
                    1
            end if;
        end if;
    end if;
end;
$$
language plpgsql;

If I wrap selects in a parantheses, it starts de-indenting between each union all:

create function foobar()
    returns table(
        "n" integer
    )
    as $$
begin
    if "_a" then
        if "_b" then
            if "_c" then
                return query(
                    select
                        1)
        union all(
            select
                1)
    union all(
        select
            1)
            end if;
        end if;
    end if;
end;
$$
language plpgsql;

I would expect it to become:

create function foobar()
    returns table(
        "n" integer
    )
    as $$
begin
    if "_a" then
        if "_b" then
            if "_c" then
                return query
                (select
                    1)
                union all
                (select
                    1)
                union all
                (select
                    1)
            end if;
        end if;
    end if;
end;
$$
language plpgsql;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0