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[] = [
6
6
'ANY' , // <- moved over from functions
7
7
'ARE' ,
8
8
'AS' ,
9
+ 'ASC' , // Not reserved in SQL-2008, but commonly reserved in most dialects
9
10
'ASENSITIVE' ,
10
11
'ASYMMETRIC' ,
11
12
'AT' ,
@@ -48,6 +49,7 @@ export const keywords: string[] = [
48
49
'DEFAULT' ,
49
50
'DELETE' ,
50
51
'DEREF' ,
52
+ 'DESC' , // Not reserved in SQL-2008, but commonly reserved in most dialects
51
53
'DESCRIBE' ,
52
54
'DETERMINISTIC' ,
53
55
'DISCONNECT' ,
Original file line number Diff line number Diff line change @@ -72,6 +72,20 @@ describe('SqlFormatter', () => {
72
72
) . toThrowError ( 'Parse error: Unexpected "{foo};" at line 2 column 3' ) ;
73
73
} ) ;
74
74
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
+
75
89
it ( 'formats ALTER TABLE ... ALTER COLUMN' , ( ) => {
76
90
expect (
77
91
format (
You can’t perform that action at this time.
0 commit comments