Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions internal/endtoend/testdata/select_union/mysql/go/query.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion internal/endtoend/testdata/select_union/mysql/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ SELECT * FROM foo;
-- name: SelectUnionOther :many
SELECT * FROM foo
UNION
SELECT * FROM bar;
SELECT * FROM bar;

-- name: SelectUnionAliased :many
(SELECT * FROM foo)
UNION
SELECT * FROM bar;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ SELECT * FROM foo;
-- name: SelectUnionOther :many
SELECT * FROM foo
UNION
SELECT * FROM bar;
SELECT * FROM bar;

-- name: SelectUnionAliased :many
(SELECT * FROM foo)
UNION
SELECT * FROM foo;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ SELECT * FROM foo;
-- name: SelectUnionOther :many
SELECT * FROM foo
UNION
SELECT * FROM bar;
SELECT * FROM bar;

-- name: SelectUnionAliased :many
(SELECT * FROM foo)
UNION
SELECT * FROM foo;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ SELECT * FROM foo;
-- name: SelectUnionOther :many
SELECT * FROM foo
UNION
SELECT * FROM bar;
SELECT * FROM bar;

-- name: SelectUnionAliased :many
(SELECT * FROM foo)
UNION
SELECT * FROM foo;
2 changes: 1 addition & 1 deletion internal/endtoend/testdata/select_union/sqlite/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ SELECT * FROM foo;
-- name: SelectUnionOther :many
SELECT * FROM foo
UNION
SELECT * FROM bar;
SELECT * FROM bar;
7 changes: 6 additions & 1 deletion internal/engine/dolphin/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,12 @@ func (c *cc) convertSetOprType(n *pcast.SetOprType) (op ast.SetOperation, all bo
func (c *cc) convertSetOprSelectList(n *pcast.SetOprSelectList) ast.Node {
selectStmts := make([]*ast.SelectStmt, len(n.Selects))
for i, node := range n.Selects {
selectStmts[i] = c.convertSelectStmt(node.(*pcast.SelectStmt))
switch node := node.(type) {
case *pcast.SelectStmt:
selectStmts[i] = c.convertSelectStmt(node)
case *pcast.SetOprSelectList:
selectStmts[i] = c.convertSetOprSelectList(node).(*ast.SelectStmt)
}
}

op, all := c.convertSetOprType(n.AfterSetOperator)
Expand Down
Loading