TablePlus / TablePlus

TablePlus macOS issue tracker
https://tableplus.com
3.39k stars 56 forks source link

beautify improvement #1191

Open georgexsh opened 5 years ago

georgexsh commented 5 years ago
  1. Which driver are you using and version of it (Ex: PostgreSQL 10.0): mysql 5

  2. Which TablePlus build number are you using (the number on the welcome screen, Ex: build 81): 226

  3. The steps to reproduce this issue:

with sql:

select * from (select * from a) as a
join (select * from b) as b on a.id=b.id

beautify:

select
  *
from (
  select
    *
  from
    a) as a
  join (
    select
      *
    from
      b) as b on a.id = b.id

better result:

select
  *
from
  (
    select
      *
    from
      a
  ) as a
  join (
    select
      *
    from
      b
  ) as b on a.id = b.id

the difference is right parathesis should break into a new line.

georgexsh commented 5 years ago

another bad case:

select
  *
from (
  select
    *
  from
    a
  group by
    d) as t

better:

select
  *
from (
  select
    *
  from
    a
  group by
    d
) as t
georgexsh commented 5 years ago
select
  *
from
  a
where
  exists (
    select
      *
    from
      b
    where
      a.id = b.id)
  order by
    id

better:

select
  *
from
  a
where
  exists (
    select
      *
    from
      b
    where
      a.id = b.id
  )
order by
  id

outer order by should not be indented.

georgexsh commented 5 years ago

for all the issues, here is a potato:

 .----._
(       )
 '-----'
jim256 commented 5 years ago

I'd like to vote for this as well