summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/optimize_joins.sql
blob: 6d5bed21b887a01d4bf5ee1a76f2f08517f586fe (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
SELECT * FROM x JOIN y ON y.a = 1 JOIN z ON x.a = z.a AND y.a = z.a;
SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = 1 AND y.a = z.a;

SELECT * FROM x JOIN y ON y.a = 1 JOIN z ON x.a = z.a;
SELECT * FROM x JOIN y ON y.a = 1 JOIN z ON x.a = z.a;

SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a;
SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a;

SELECT * FROM x LEFT JOIN y ON y.a = 1 JOIN z ON x.a = z.a AND y.a = z.a;
SELECT * FROM x JOIN z ON x.a = z.a AND TRUE LEFT JOIN y ON y.a = 1 AND y.a = z.a;

SELECT * FROM x INNER JOIN z ON x.id = z.id;
SELECT * FROM x JOIN z ON x.id = z.id;

SELECT * FROM x LEFT OUTER JOIN z;
SELECT * FROM x LEFT JOIN z ON TRUE;

SELECT * FROM x CROSS JOIN z;
SELECT * FROM x CROSS JOIN z;

SELECT * FROM x JOIN z;
SELECT * FROM x CROSS JOIN z;

SELECT * FROM x FULL JOIN z;
SELECT * FROM x FULL JOIN z ON TRUE;

SELECT * FROM x NATURAL JOIN z;
SELECT * FROM x NATURAL JOIN z ON TRUE;

SELECT * FROM x RIGHT JOIN z;
SELECT * FROM x RIGHT JOIN z ON TRUE;

SELECT * FROM x JOIN z USING (id);
SELECT * FROM x JOIN z USING (id);

SELECT * FROM x CROSS JOIN z ON TRUE;
SELECT * FROM x CROSS JOIN z;