[parser] parser.y: populate the Fields field for TABLE and VALUES statements (#1118)

This commit is contained in:
kennytm
2020-12-08 16:45:50 +08:00
committed by Ti Chi Robot
parent 79fbb96097
commit 9fb295fcc8
2 changed files with 10 additions and 6 deletions

View File

@ -15320,7 +15320,8 @@ yynewstate:
case 1367:
{
st := &ast.SelectStmt{
Kind: ast.SelectStmtKindTable,
Kind: ast.SelectStmtKindTable,
Fields: &ast.FieldList{Fields: []*ast.SelectField{{WildCard: &ast.WildCardField{}}}},
}
ts := &ast.TableSource{Source: yyS[yypt-4].item.(*ast.TableName)}
st.From = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}}
@ -15341,8 +15342,9 @@ yynewstate:
case 1368:
{
st := &ast.SelectStmt{
Kind: ast.SelectStmtKindValues,
Lists: yyS[yypt-4].item.([]*ast.RowExpr),
Kind: ast.SelectStmtKindValues,
Fields: &ast.FieldList{Fields: []*ast.SelectField{{WildCard: &ast.WildCardField{}}}},
Lists: yyS[yypt-4].item.([]*ast.RowExpr),
}
if yyS[yypt-3].item != nil {
st.OrderBy = yyS[yypt-3].item.(*ast.OrderByClause)

View File

@ -7628,7 +7628,8 @@ SelectStmt:
| "TABLE" TableName OrderByOptional SelectStmtLimitOpt SelectLockOpt SelectStmtIntoOption
{
st := &ast.SelectStmt{
Kind: ast.SelectStmtKindTable,
Kind: ast.SelectStmtKindTable,
Fields: &ast.FieldList{Fields: []*ast.SelectField{{WildCard: &ast.WildCardField{}}}},
}
ts := &ast.TableSource{Source: $2.(*ast.TableName)}
st.From = &ast.TableRefsClause{TableRefs: &ast.Join{Left: ts}}
@ -7649,8 +7650,9 @@ SelectStmt:
| "VALUES" ValuesStmtList OrderByOptional SelectStmtLimitOpt SelectLockOpt SelectStmtIntoOption
{
st := &ast.SelectStmt{
Kind: ast.SelectStmtKindValues,
Lists: $2.([]*ast.RowExpr),
Kind: ast.SelectStmtKindValues,
Fields: &ast.FieldList{Fields: []*ast.SelectField{{WildCard: &ast.WildCardField{}}}},
Lists: $2.([]*ast.RowExpr),
}
if $3 != nil {
st.OrderBy = $3.(*ast.OrderByClause)