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 d5de069

Browse files
authored
Merge pull request #35 from JavaScriptor/hotfix-tablefactor-alias
fix: #34
2 parents 90031e3 + 394e5cc commit d5de069

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

‎src/sqlParser.jison‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,6 @@ index_hint
585585
;
586586
table_factor
587587
: identifier partitionOpt aliasOpt index_hint_list_opt { $$ = { type: 'TableFactor', value: 1ドル, partition: 2ドル, alias: 3ドル.alias, hasAs: 3ドル.hasAs, indexHintOpt: 4ドル } }
588-
| '(' selectClause ')' aliasOpt { $$ = { type: 'SubQuery', value: 2ドル, alias: 4ドル.alias, hasAs: 4ドル.hasAs} }
588+
| '(' selectClause ')' aliasOpt { $$ = { type: 'TableFactor', value: { type:'SubQuery', value: 2ドル }, alias: 4ドル.alias, hasAs: 4ドル.hasAs} }
589589
| '(' table_references ')' { $$ = 2ドル; $$.hasParentheses = true }
590590
;

‎test/main.test.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,18 @@ describe('select grammar support', function() {
397397
testParser('select a as `A|A` from b limit 2;');
398398
testParser('select a as `A A` from b limit 2;');
399399
});
400+
401+
it('bugfix table alias', function() {
402+
testParser(`
403+
SELECT stime, A.names, B.names FROM (
404+
SELECT stime, names FROM iaas_data.iaas_d3c0d0681cc1900
405+
) AS A LEFT JOIN (
406+
SELECT stime, names FROM iaas_data.iaas_1071f89feaa0e100
407+
) AS B ON A.stime = B.stime
408+
`);
409+
});
410+
411+
it('bugfix table alias2', function() {
412+
testParser('select a.* from a t1 join b t2 on t1.a = t2.a')
413+
})
400414
});

0 commit comments

Comments
(0)

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