forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ST07.yml
74 lines (63 loc) · 2.19 KB
/
ST07.yml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
rule: ST07
test_pass_specify_join_keys:
pass_str: select x.a from x inner join y on x.id = y.id
test_fail_specify_join_keys_1:
fail_str: select x.a from x inner join y using (id)
fix_str: select x.a from x inner join y ON x.id = y.id
test_fail_specify_join_keys_1_with_alias:
fail_str: select x.a from foo_table AS x inner join y using (id)
fix_str: select x.a from foo_table AS x inner join y ON x.id = y.id
test_fail_specify_join_keys_1_with_subquery:
fail_str: select x.a from (SELECT 1 AS a) AS x inner join y using (id)
fix_str: select x.a from (SELECT 1 AS a) AS x inner join y ON x.id = y.id
test_fail_specify_join_keys_1_with_multi_using:
fail_str: select x.a from x inner join y using (id, a)
fix_str: select x.a from x inner join y ON x.id = y.id AND x.a = y.a
test_fail_specify_join_keys_2:
desc: Keys were specified for first join but not the second one.
fail_str: select x.a from x inner join y on x.id = y.id inner join z using (id)
test_partial_fixed_up_to_2nd_join:
fail_str: |
select x.a
from x
inner join y using(id, foo)
inner join z using(id)
fix_str: |
select x.a
from x
inner join y ON x.id = y.id AND x.foo = y.foo
inner join z using(id)
violations_after_fix:
- description: Found USING statement. Expected only ON statements.
line_no: 4
line_pos: 14
name: structure.using
select_using_fail:
fail_str: |
SELECT *
FROM A_TABLE
INNER JOIN (
SELECT margin
FROM B_TABLE
) USING (SOME_COLUMN)
test_fail_parent_child_positioning:
# Check for issue from https://github.com/sqlfluff/sqlfluff/issues/3656
fail_str: |
select * from c1 join c2 using (ID)
join (select * from c3 join c4 using (ID)) as c5 on c1.ID = c5.ID
fix_str: |
select * from c1 join c2 ON c1.ID = c2.ID
join (select * from c3 join c4 ON c3.ID = c4.ID) as c5 on c1.ID = c5.ID
fail_but_dont_fix_templated_table_names:
fail_str: |
SELECT
{{ "table_a" }}.field_1,
table_b.field_2
FROM
{{ "table_a" }}
INNER JOIN table_b USING (id)
test_pass_clickhouse:
pass_str: SELECT * FROM test1 as t1 LEFT SEMI JOIN test2 USING ty1,ty2;
configs:
core:
dialect: clickhouse