-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit adds support for UNION query in the compiler. It adds test cases for UNION in a SELECT and in a recursive CTE. It fixes sqlc-dev#568, sqlc-dev#723 and sqlc-dev#778.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE TABLE bar (id INT NOT NULL, parent_id INT); | ||
|
||
-- name: CTERecursive :many | ||
WITH RECURSIVE cte AS ( | ||
SELECT b.* FROM bar AS b | ||
WHERE b.id = $1 | ||
UNION ALL | ||
SELECT b.* | ||
FROM bar AS b, cte AS c | ||
WHERE b.parent_id = c.id | ||
) SELECT * FROM cte; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "1", | ||
"packages": [ | ||
{ | ||
"path": "go", | ||
"name": "querytest", | ||
"schema": "query.sql", | ||
"queries": "query.sql" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE foo (a text, b text); | ||
|
||
-- name: SelectUnion :many | ||
SELECT * FROM foo | ||
UNION | ||
SELECT * FROM foo; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "1", | ||
"packages": [ | ||
{ | ||
"path": "go", | ||
"name": "querytest", | ||
"schema": "query.sql", | ||
"queries": "query.sql" | ||
} | ||
] | ||
} |