pgFormatter icon indicating copy to clipboard operation
pgFormatter copied to clipboard

Breaks query when CTE is present

Open trsdln opened this issue 3 years ago • 1 comments

Input query:

some_cte as (select a from test_table)
select
  my_fn ((select * from some_cte1))
from
  test_table;

Expected output query:

some_cte as (
  select
    a
  from
    test_table
)
select
  my_fn ((
    select
      *
    from some_cte1))
from
  test_table;

Actual output query:

some_cte as (
  select
    a
  from
    test_table
)
select
  my_fn (
    select
      *
    from some_cte1)
from
  test_table;

Removing one pair of round brackets breaks the query.

pgformatter version: 5.3

trsdln avatar Oct 20 '22 10:10 trsdln

Right, most of the remaining open issue on pgFormatter are about CTE formatting. Unfortunately fixing them require a huge work in pgFormatter code so it require lot of time. That sadly, I don't have for the moment.

darold avatar Oct 20 '22 11:10 darold