This commit is contained in:
HSunboy 2018-09-03 16:25:47 +08:00
parent 25a3f892f7
commit 8902672269
2 changed files with 20 additions and 12 deletions

View File

@ -4349,9 +4349,11 @@ case 1320:
}; };
if ($$[$0-1]) { if ($$[$0-1]) {
this.$.primary.alias = $$[$0-1].alias; if(this.$.primary){
parser.addTablePrimary({ subQueryAlias: $$[$0-1].alias }); this.$.primary.alias = $$[$0-1].alias;
parser.addSubqueryAliasLocation($$[$0-1].location, $$[$0-1].alias, $$[$0-2].identifierChain); parser.addTablePrimary({ subQueryAlias: $$[$0-1].alias });
parser.addSubqueryAliasLocation($$[$0-1].location, $$[$0-1].alias, $$[$0-2].identifierChain);
}
} }
var keywords = []; var keywords = [];
@ -4451,10 +4453,12 @@ break;
case 1355: case 1355:
var subQuery = parser.getSubQuery($$[$0]); var subQuery = parser.getSubQuery($$[$0]);
subQuery.columns.forEach(function (column) { if(subQuery){
parser.expandIdentifierChain({ wrapper: column }); subQuery.columns.forEach(function (column) {
delete column.linked; parser.expandIdentifierChain({ wrapper: column });
delete column.linked;
}); });
}
parser.popQueryState(subQuery); parser.popQueryState(subQuery);
this.$ = subQuery; this.$ = subQuery;

View File

@ -2958,9 +2958,11 @@ TablePrimary
}; };
if ($2) { if ($2) {
$$.primary.alias = $2.alias; if($$.primary){
parser.addTablePrimary({ subQueryAlias: $2.alias }); $$.primary.alias = $2.alias;
parser.addSubqueryAliasLocation($2.location, $2.alias, $1.identifierChain); parser.addTablePrimary({ subQueryAlias: $2.alias });
parser.addSubqueryAliasLocation($2.location, $2.alias, $1.identifierChain);
}
} }
var keywords = []; var keywords = [];
@ -3127,10 +3129,12 @@ TableSubQueryInner
: PushQueryState SubQuery : PushQueryState SubQuery
{ {
var subQuery = parser.getSubQuery($2); var subQuery = parser.getSubQuery($2);
subQuery.columns.forEach(function (column) { if(subQuery){
parser.expandIdentifierChain({ wrapper: column }); subQuery.columns.forEach(function (column) {
delete column.linked; parser.expandIdentifierChain({ wrapper: column });
delete column.linked;
}); });
}
parser.popQueryState(subQuery); parser.popQueryState(subQuery);
$$ = subQuery; $$ = subQuery;
} }