Skip to content

Discussion [postgres]: ideal way to format SELECT/PERFORM statements with a single column? #75

Description

@joelmukuthu

This may not be a bug necessarily, but this:

SELECT some_function_name(
  arg => 1
);

Gets transformed to:

SELECT
  some_function_name(arg => 1);

Whereas I'd expect:

SELECT some_function_name(arg => 1);
-- OR:
SELECT some_function_name(
  arg => 1
);

I understand why this happens but perhaps the plugin could pre-check if converting to hanging indent is necessary. Some other examples:

-- this one makes sense:
SELECT
  loooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_function_name();

-- here perhaps the hanging indent could be removed: 
SELECT
  some_function_name(
    foo => 1,
    bar => 2,
    bar => 2,
    bar => 2,
    bar => 2,
    bar => 2,
    bar => 2
  );

Worth noting that for functions with no params, there's no hanging indent:

SELECT some_function_name();

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