Window clause not recognized  

  

0

Hello, Guido

Currently the np++ plugin does not recognize PostgreSQL's "WINDOW" clause.

It would be great if you could add this functionality.

Example 1: how I format the code

SELECT
    t.col1                             AS alias1
    , lag( t.col2 ) OVER win1          AS alias2
    , first_value( t.col3 ) OVER win2  AS alias3
FROM
    table1                             t
WINDOW 
    win1                               AS ( ORDER BY t.col4 )
    , win2                             AS ( PARTITION by t.col5 )

Example 2: how the plugin formats it

SELECT
    t.col1                             AS alias1
    , lag( t.col2 ) over win1          AS alias2
    , first_value( t.col3 ) OVER win2  AS alias3
FROM
    table1 t window win1               AS( ORDER BY t.col4 )
    , win2                             AS( PARTITION by t.col5 )

Thanks!

Hi cesarwal ,
many thanks for your suggestion.
It looks like the WINDOW keyword should be parsed in a similar way as the "FROM" keyword. Do you agree?

Yes, if it's parsed like the FROM keyword, it would be perfect

thanks, I hope I can add it this weekend

1 Answer
0

Hi cesarwal,

ok, plugin has been updated and uploaded. Please download the dll (Rel. 5.3.32) from here and copy it to the plugin folder

Preview:

 

Your Answer


 
Preview 0 Revisions Saved
Share:

Please Login or Register