Content-Length: 317944 | pFad | http://github.com/JavaScriptor/js-sql-parser/commit/394e5cc0d6aa255776214459314dc171a5bada0c

22 fix: #34 · JavaScriptor/js-sql-parser@394e5cc · GitHub
Skip to content

Commit 394e5cc

Browse files
committed
fix: #34
1 parent 90031e3 commit 394e5cc

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/JavaScriptor/js-sql-parser/commit/394e5cc0d6aa255776214459314dc171a5bada0c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy