Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bb66951

Browse files
authored
Merge pull request #33 from TrackTik/master
feat: add support for "`" quoted alias
2 parents 0374378 + d3c4871 commit bb66951

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎src/sqlParser.jison

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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

284287
string

‎test/main.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /