summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/eliminate_ctes.sql
blob: 11e5e4f2490e161c503fee72fd3fdf2710027e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# title: CTE
WITH q AS (
  SELECT
    a
  FROM x
)
SELECT
  a
FROM x;
SELECT
  a
FROM x;

# title: Nested CTE
SELECT
  a
FROM (
  WITH q AS (
    SELECT
      a
    FROM x
  )
  SELECT a FROM x
);
SELECT
  a
FROM (
  SELECT
    a
  FROM x
);

# title: Chained CTE
WITH q AS (
  SELECT
    a
  FROM x
), r AS (
  SELECT
    a
  FROM q
)
SELECT
  a
FROM x;
SELECT
  a
FROM x;