File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export const keywords: string[] = [
66 'ANY' , // <- moved over from functions
77 'ARE' ,
88 'AS' ,
9+ 'ASC' , // Not reserved in SQL-2008, but commonly reserved in most dialects
910 'ASENSITIVE' ,
1011 'ASYMMETRIC' ,
1112 'AT' ,
@@ -48,6 +49,7 @@ export const keywords: string[] = [
4849 'DEFAULT' ,
4950 'DELETE' ,
5051 'DEREF' ,
52+ 'DESC' , // Not reserved in SQL-2008, but commonly reserved in most dialects
5153 'DESCRIBE' ,
5254 'DETERMINISTIC' ,
5355 'DISCONNECT' ,
Original file line number Diff line number Diff line change @@ -72,6 +72,20 @@ describe('SqlFormatter', () => {
7272 ) . toThrowError ( 'Parse error: Unexpected "{foo};" at line 2 column 3' ) ;
7373 } ) ;
7474
75+ // Issue #702
76+ it ( 'treats ASC and DESC as reserved keywords' , ( ) => {
77+ expect ( format ( `SELECT foo FROM bar ORDER BY foo asc, zap desc` , { keywordCase : 'upper' } ) )
78+ . toBe ( dedent `
79+ SELECT
80+ foo
81+ FROM
82+ bar
83+ ORDER BY
84+ foo ASC,
85+ zap DESC
86+ ` ) ;
87+ } ) ;
88+
7589 it ( 'formats ALTER TABLE ... ALTER COLUMN' , ( ) => {
7690 expect (
7791 format (
You can’t perform that action at this time.
0 commit comments