Treating SELECT JOIN "USING" keyword the same as "ON"

4 Posts
2 Users
0 Reactions
16 Views
 kick
(@kick)
Member
Joined: 4 years ago
Posts: 13
Topic starter  

Have you considered handling for the JOIN "USING" keyword the same as "ON"?

There are newline before and after formatting options for the ON keyword when used in a JOIN clause but not for the increasingly common USING keyword/clause. It also appears that manipulating the USING options under the SQL/"Merge" section had no effect (as I would expect).  I think they should be treated the same. e.g., in the SQL/"SELECT" section 

        ☐ ☐ ON        Would become      ☐ ☐ ON/USING

Consider the generated formatted code below and the Notepad++ settings which result in my JOINs clauses are formatted differently for the same logical equivalent.

  • Note that there is no newline after "ON" but is after "USING"
  • Not sure why I am getting the two spaces between "(" and "t1.id" but that is a separate topic for a different day.
Generated Formatted Code Settings in Notepad++
SELECT
*
FROM t1
JOIN t2
USING
(id)
JOIN t3 ON ( t1.id = t2.id)
 

image
This topic was modified 5 days ago by kick

   
Quote
Guido
(@admin)
Member Admin
Joined: 4 years ago
Posts: 239
 

Hi @kick,

thanks for your feedback. 

I will check if I cann add this idea to the formatter.

Which DB are you working with?

Regards

Guido


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 4 years ago
Posts: 239
 

Hi @kick

could you please give the new version a try

grafik

   
ReplyQuote
 kick
(@kick)
Member
Joined: 4 years ago
Posts: 13
Topic starter  

Hi Guido,

That worked as desired, Thank you.

I am using it with Yellowbrick and PostgreSQL variants. According to Wikipedia List_of_SQL_reserved_words, The USING keyword is included in the SQL-2023 standard and works in DB2, MySQL, PG, and Teradata but NOT Oracle or MSsql


   
ReplyQuote
Share: