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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions regression-test/data/query_p0/with/test_with.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,16 @@
1
1

-- !select --
1 2 1 2

-- !select --
1
2
3

-- !select --
1
2
3

26 changes: 26 additions & 0 deletions regression-test/suites/query_p0/with/test_with.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,34 @@

suite("test_with") {
sql "use test_query_db"
//Basic WITH
qt_select """
select 1 from (with w as (select 1 from baseall
where exists (select 1 from baseall)) select 1 from w ) tt
"""
qt_select """
WITH q1(x,y) AS (SELECT 1,2)
SELECT * FROM q1, q1 AS q2;
"""

qt_select """
WITH outermost(x) AS (
SELECT 1
UNION (WITH innermost as (SELECT 2)
SELECT * FROM innermost
UNION SELECT 3)
)
SELECT x FROM outermost order by 1;
"""
qt_select """
WITH outermost(x) AS (
SELECT 1
UNION (WITH innermost as (SELECT 2)
SELECT * FROM innermost
UNION SELECT 3)
)
SELECT * FROM outermost ORDER BY 1;
"""


}