File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ UNION return 'UNION'
127127[a-zA-Z_\u4e00 -\u9fa5 ][a-zA-Z0-9_\u4e00 -\u9fa5 ] * return ' IDENTIFIER'
128128\. return ' DOT'
129129['"][a-zA-Z_\u4e00 -\u9fa5 ][a-zA-Z0-9_\u4e00 -\u9fa5 ] * ["'] return ' QUOTED_IDENTIFIER'
130+ [`] . + [`] return ' QUOTED_IDENTIFIER'
130131
131132<<EOF>> return ' EOF'
132133. return ' INVALID'
@@ -279,6 +280,8 @@ selectExprAliasOpt
279280 : { $$ = {alias: null , hasAs: null } }
280281 | AS IDENTIFIER { $$ = {alias: $2 , hasAs: true } }
281282 | IDENTIFIER { $$ = {alias: $1 , hasAs: false } }
283+ | AS QUOTED_IDENTIFIER { $$ = {alias: $2 , hasAs: true } }
284+ | QUOTED_IDENTIFIER { $$ = {alias: $1 , hasAs: false } }
282285 ;
283286
284287string
Original file line number Diff line number Diff line change @@ -387,4 +387,14 @@ describe('select grammar support', function() {
387387 'select a from dual order by a desc limit 1, 1 union distinct select a from foo order by a limit 1'
388388 ) ;
389389 } ) ;
390+
391+ it ( 'support quoted alias' , function ( ) {
392+ testParser ( 'select a as `A-A` from b limit 2;' ) ;
393+ testParser ( 'select a as `A#A` from b limit 2;' ) ;
394+ testParser ( 'select a as `A?A` from b limit 2;' ) ;
395+ testParser ( 'select a as `A/B` from b limit 2;' ) ;
396+ testParser ( 'select a as `A.A` from b limit 2;' ) ;
397+ testParser ( 'select a as `A|A` from b limit 2;' ) ;
398+ testParser ( 'select a as `A A` from b limit 2;' ) ;
399+ } ) ;
390400} ) ;
You can’t perform that action at this time.
0 commit comments