forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AL05.yml
1179 lines (1055 loc) · 25.3 KB
/
AL05.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
rule: AL05
test_fail_table_alias_not_referenced_1:
# Aliases not referenced.
fail_str: SELECT * FROM my_tbl AS foo
fix_str: SELECT * FROM my_tbl
test_fail_table_alias_not_referenced_1_subquery:
# Aliases not referenced.
fail_str: SELECT * FROM (SELECT * FROM my_tbl AS foo)
fix_str: SELECT * FROM (SELECT * FROM my_tbl)
test_pass_table_alias_referenced_subquery:
pass_str: SELECT * FROM (SELECT foo.bar FROM my_tbl AS foo)
test_pass_table_alias_referenced:
pass_str: SELECT * FROM my_tbl AS foo JOIN other_tbl on other_tbl.x = foo.x
test_pass_unaliased_table_referenced:
# AL05 fix with https://github.com/sqlfluff/sqlfluff/issues/449
pass_str: select ps.*, pandgs.blah from ps join pandgs using(moo)
test_ignore_bigquery_value_table_functions:
# AL05 fix with https://github.com/sqlfluff/sqlfluff/issues/356
pass_str: |
select *
from unnest(generate_timestamp_array(
'2020-01-01', '2020-01-30', interval 1 day)) as ts
configs:
core:
dialect: bigquery
test_ignore_postgres_value_table_functions:
# AL05 fix with https://github.com/sqlfluff/sqlfluff/issues/3051
pass_str: |
SELECT json_build_object(
'name', 'ticket_status',
'type', 'enum',
'values', json_agg(status_name)
)
FROM unnest(enum_range(NULL::my_enum)) AS status_name;
configs:
core:
dialect: postgres
test_ignore_postgres_value_table_functions_generate_series:
# AL05 fix with https://github.com/sqlfluff/sqlfluff/issues/3462
pass_str: |
SELECT
date_trunc('day', dd):: timestamp with time zone
FROM generate_series (
'2022-02-01'::timestamp , NOW()::timestamp , '1 day'::interval
) dd ;
configs:
core:
dialect: postgres
test_fail_table_alias_not_referenced_2:
# Similar to test_1, but with implicit alias.
fail_str: SELECT * FROM my_tbl foo
fix_str: SELECT * FROM my_tbl
test_fail_table_alias_not_referenced_2_subquery:
# Aliases not referenced.
fail_str: SELECT * FROM (SELECT * FROM my_tbl foo)
fix_str: SELECT * FROM (SELECT * FROM my_tbl)
test_pass_subquery_alias_not_referenced:
pass_str: select * from (select 1 as a) subquery
test_pass_bigquery_unaliased_table_with_hyphens:
# Test non-quoted table name containing hyphens: https://github.com/sqlfluff/sqlfluff/issues/895
# This is more of a smoke test to exercise the
# ObjectReferenceSegment.extract_reference() function, which is used by AL05
# and in turn calls HyphenatedObjectReferenceSegment.iter_raw_references().
pass_str: |
select *
from project-a.dataset-b.table-c
configs:
core:
dialect: bigquery
test_pass_bigquery_aliased_table_with_ticks_referenced:
# Test ambiguous column reference caused by use of BigQuery structure fields.
# Here, 'et2' could either be a schema name or a table name.
# https://github.com/sqlfluff/sqlfluff/issues/1079
pass_str: |
SELECT et2.txn.amount
FROM `example_dataset2.example_table2` AS et2
configs:
core:
dialect: bigquery
test_pass_tsql_object_reference_override:
# T-SQL Overrides the ObjectReferenceSegment so needs to have the _level_to_int
# static method set (as a static method!) or rule AL05 fails.
# https://github.com/sqlfluff/sqlfluff/issues/1669
pass_str: SELECT a FROM b
configs:
core:
dialect: tsql
test_pass_subselect_uses_alias_1:
pass_str: |
SELECT
col1,
(
SELECT count(*)
FROM base
WHERE a.col2 = base.col2
)
FROM
without_dup AS a
test_pass_subselect_uses_alias_2:
pass_str: |
select
COL_A
, COL_B
from INSERTS INS
where COL_B != (select max(COL_B) from INSERTS X where INS.COL_A = X.COL_A)
test_pass_subselect_uses_alias_3:
pass_str: |
SELECT col_1
FROM table_a AS a
WHERE NOT EXISTS (SELECT TRUE FROM table_b AS b WHERE a.col_4 = b.col_1)
test_ansi_function_not_table_parameter:
fail_str: |
SELECT TO_JSON_STRING(t)
FROM my_table AS t
fix_str: |
SELECT TO_JSON_STRING(t)
FROM my_table
test_bigquery_function_takes_tablealias_parameter:
pass_str: |
SELECT TO_JSON_STRING(t)
FROM my_table AS t
configs:
core:
dialect: bigquery
test_bigquery_function_takes_tablealias_column_parameter:
pass_str: |
SELECT TO_JSON_STRING(t.c)
FROM my_table AS t
configs:
core:
dialect: bigquery
test_bigquery_function_takes_tablealias_column_struct_parameter:
pass_str: |
SELECT TO_JSON_STRING(t.c.structure)
FROM my_table AS t
configs:
core:
dialect: bigquery
test_snowflake_delete_cte:
fail_str: |
DELETE FROM MYTABLE1
USING (
WITH MYCTE AS (SELECT COLUMN2 FROM MYTABLE3 AS MT3)
SELECT COLUMN3 FROM MYTABLE3
) X
WHERE COLUMN1 = X.COLUMN3
fix_str: |
DELETE FROM MYTABLE1
USING (
WITH MYCTE AS (SELECT COLUMN2 FROM MYTABLE3)
SELECT COLUMN3 FROM MYTABLE3
) X
WHERE COLUMN1 = X.COLUMN3
configs:
core:
dialect: snowflake
test_pass_exasol_values_clause:
pass_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
)
configs:
core:
dialect: exasol
test_fail_exasol_values_clause:
fail_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
) AS t(c1, c2)
fix_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
)
configs:
core:
dialect: exasol
test_pass_sparksql_values_clause:
pass_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
)
configs:
core:
dialect: sparksql
test_fail_sparksql_values_clause:
fail_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
) AS t(c1, c2)
fix_str: |
SELECT *
FROM (
VALUES (1, 2), (3, 4)
)
configs:
core:
dialect: sparksql
test_pass_snowflake_values:
# Tests a fix for issue 3301.
pass_str: |
SELECT
thing_1
, thing_2
FROM VALUES
( 'foo', 'bar')
, ( 'foo', 'bar')
my_table_alias(thing_1, thing_2)
configs:
core:
dialect: snowflake
test_pass_tsql_values_clause_in_parentheses:
# Tests a fix for issue 3522. In tsql, the parentheses surrounding "values" are
# required (otherwise syntax error). SQLFluff was incorrectly complaining that
# the alias 't' was unused.
pass_str: |
SELECT *
FROM (VALUES
('a1', 'b1'),
('a2', 'b2'),
('a3', 'b3')) t(a,b)
configs:
core:
dialect: tsql
test_pass_join_on_expression_in_parentheses:
pass_str: |
SELECT table1.c1
FROM
table1 AS tbl1
INNER JOIN table2 AS tbl2 ON (tbl2.col2 = tbl1.col2)
INNER JOIN table3 AS tbl3 ON (tbl3.col3 = tbl2.col3)
test_pass_bigquery_qualify_clause:
pass_str: |
SELECT *
FROM
table1 AS tbl1
INNER JOIN tbl2 AS tbl2
WHERE TRUE
QUALIFY ROW_NUMBER() OVER (
PARTITION BY tbl1.col1
ORDER BY tbl2.col3
) = 1
configs:
core:
dialect: bigquery
test_pass_bigquery_nested_inner_join:
pass_str: |
with abh as (
select
ceb.emailaddresskey,
dac.accountkey
from table2 as dac
inner join table3 as ceb
on ceb.col2 = dac.col2
)
select col1
from table1 as abg
inner join abh
on abg.col1 = abh.col1
configs:
core:
dialect: bigquery
test_fail_snowflake_flatten_function:
# Tests a fix for issue 3178.
fail_str: |
SELECT
r.rec:foo::string,
value:bar::string
FROM foo.bar AS r, LATERAL FLATTEN(input => rec:result) AS x
fix_str: |
SELECT
r.rec:foo::string,
value:bar::string
FROM foo.bar AS r, LATERAL FLATTEN(input => rec:result)
configs:
core:
dialect: snowflake
test_pass_derived_query_requires_alias_1:
# Case 1: Simple derived query
pass_str: |
SELECT * FROM (
SELECT 1
) as a
test_pass_derived_query_requires_alias_2:
# Case 2: Derived query uses set operation (UNION)
pass_str: |
SELECT * FROM (
SELECT col FROM dbo.tab
UNION
SELECT -1 AS col
) AS a
test_pass_derived_query_requires_alias_3:
# Case 3: Derived query includes a WITH statement
pass_str: |
SELECT * FROM (
WITH foo AS (
SELECT col FROM dbo.tab
)
SELECT * FROM foo
) AS a
test_pass_redshift_semi_structured_op:
# Redshift _requires_ aliasing when doing semi-structured operations.
# https://docs.aws.amazon.com/redshift/latest/dg/query-super.html#unnest
# The logic here should be that if references _overlap_ (i.e. some
# aliases refer to other tables in the same FROM clause).
pass_str: |
SELECT tt.resource_id
FROM top_table AS tt
, tt.nested_column AS co
configs:
core:
dialect: redshift
test_pass_postgres_values_clause:
pass_str: |
SELECT *
FROM (
VALUES
(1, 2),
(3, 4)
) AS t (x, y)
configs:
core:
dialect: postgres
# Quoted identifiers case-sensitive tests
test_pass_naked_select_single_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as 'A'
test_fail_naked_select_single_quoted_table_wrong_case:
fail_str: |
SELECT a.col1
FROM tab1 as 'a'
fix_str: |
SELECT a.col1
FROM tab1
test_pass_naked_select_single_quoted_table_ci:
pass_str: |
SELECT a.col1
FROM tab1 as 'a'
configs:
rules:
aliasing.unused:
alias_case_check: case_insensitive
test_pass_naked_select_single_quoted_table_qcs_nup:
pass_str: |
SELECT a.col_1
FROM table_a AS 'A'
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_upper
test_fail_naked_select_single_quoted_table_wrong_case_qcs_nup:
fail_str: |
SELECT a.col_1
FROM table_a AS 'a'
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_upper
test_pass_naked_select_single_quoted_table_qcs_nlow:
pass_str: |
SELECT a.col_1
FROM table_a AS 'a'
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_lower
test_fail_naked_select_single_quoted_table_wrong_case_qcs_nlow:
fail_str: |
SELECT a.col_1
FROM table_a AS 'A'
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_lower
test_pass_naked_select_single_quoted_table_lower_cs:
pass_str: |
SELECT a.col_1
FROM table_a AS 'a'
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_pass_naked_select_single_quoted_table_upper_cs:
pass_str: |
SELECT A.col_1
FROM table_a AS 'A'
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_fail_naked_select_single_quoted_table_wrong_case_cs:
fail_str: |
SELECT a.col_1
FROM table_a AS 'A'
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_pass_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as "A"
test_pass_quoted_select_naked_table:
pass_str: |
SELECT "A".col1
FROM tab1 as a
test_pass_naked_select_quoted_table_subquery:
pass_str: |
SELECT col_1
FROM table_a AS "A"
WHERE NOT EXISTS (SELECT TRUE FROM table_b AS b WHERE a.col_4 = b.col_1)
test_pass_quoted_select_naked_table_subquery:
pass_str: |
SELECT col_1
FROM table_a AS a
WHERE NOT EXISTS (SELECT TRUE FROM table_b AS b WHERE "A".col_4 = b.col_1)
test_pass_naked_select_double_quoted_table_ci:
pass_str: |
SELECT a.col1
FROM tab1 as "a"
configs:
rules:
aliasing.unused:
alias_case_check: case_insensitive
test_pass_naked_select_double_quoted_table_qcs_nup:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_upper
test_fail_naked_select_double_quoted_table_wrong_case_qcs_nup:
fail_str: |
SELECT a.col_1
FROM table_a AS "a"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_upper
test_pass_naked_select_double_quoted_table_qcs_nlow:
pass_str: |
SELECT a.col_1
FROM table_a AS "a"
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_lower
test_fail_naked_select_double_quoted_table_wrong_case_qcs_nlow:
fail_str: |
SELECT a.col_1
FROM table_a AS "A"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: quoted_cs_naked_lower
test_pass_naked_select_double_quoted_table_lower_cs:
pass_str: |
SELECT a.col_1
FROM table_a AS "a"
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_pass_naked_select_double_quoted_table_upper_cs:
pass_str: |
SELECT A.col_1
FROM table_a AS "A"
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_fail_naked_select_double_quoted_table_wrong_case_cs:
fail_str: |
SELECT a.col_1
FROM table_a AS "A"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
rules:
aliasing.unused:
alias_case_check: case_sensitive
test_pass_athena_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as "A"
configs:
core:
dialect: athena
test_pass_athena_quoted_select_naked_table:
pass_str: |
SELECT "A".col1
FROM tab1 as a
configs:
core:
dialect: athena
test_pass_athena_naked_select_back_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as `A`
configs:
core:
dialect: athena
test_pass_athena_back_quoted_select_naked_table:
pass_str: |
SELECT `A`.col1
FROM tab1 as a
configs:
core:
dialect: athena
test_pass_bigquery_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as `A`
configs:
core:
dialect: bigquery
test_pass_bigquery_quoted_select_naked_table:
pass_str: |
SELECT `A`.col1
FROM tab1 as a
configs:
core:
dialect: bigquery
test_pass_bigquery_quoted_escapes:
pass_str: |
SELECT `\`a`.col1
FROM tab1 as `\`A`
configs:
core:
dialect: bigquery
test_pass_clickhouse_naked_select_quoted_table:
pass_str: |
SELECT a.col1, b.col2
FROM tab1 as `a`
CROSS JOIN tab2 as "b"
configs:
core:
dialect: clickhouse
test_pass_clickhouse_quoted_select_naked_table:
pass_str: |
SELECT `a`.col1, "b".col2
FROM tab1 as a
CROSS JOIN tab2 as b
configs:
core:
dialect: clickhouse
test_pass_clickhouse_quoted_escapes:
pass_str: |
SELECT "\"`a`""".col1,
FROM tab1 as `"\`a``"`
configs:
core:
dialect: clickhouse
test_fail_clickhouse_naked_select_quoted_table_cs:
fail_str: |
SELECT a.col1
FROM tab1 as `A`
fix_str: |
SELECT a.col1
FROM tab1
configs:
core:
dialect: clickhouse
test_pass_clickhouse_quoted_select_naked_table_cs:
fail_str: |
SELECT `A`.col1
FROM tab1 as a
fix_str: |
SELECT `A`.col1
FROM tab1
configs:
core:
dialect: clickhouse
test_pass_db2_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: db2
test_fail_db2_naked_select_double_quoted_table_wrong_case:
fail_str: |
SELECT a.col_1
FROM table_a AS "a"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
core:
dialect: db2
test_pass_duckdb_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: duckdb
test_pass_duckdb_quoted_select_naked_table:
pass_str: |
SELECT "a".col_1
FROM table_a AS A
configs:
core:
dialect: duckdb
test_pass_duckdb_quoted_select_single_quote_table:
pass_str: |
SELECT "'""a""'".col_1
FROM table_a AS '''"A"'''
configs:
core:
dialect: duckdb
test_fail_duckdb_single_quote_select_naked_table:
fail_str: |
SELECT 'a'[1]
FROM table_a AS A
fix_str: |
SELECT 'a'[1]
FROM table_a
configs:
core:
dialect: duckdb
test_pass_exasol_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: exasol
test_pass_exasol_quoted_select_naked_table:
pass_str: |
SELECT "A".col_1
FROM table_a AS a
configs:
core:
dialect: exasol
test_fail_exasol_quoted_select_naked_table_wrong_case:
fail_str: |
SELECT "a".col_1
FROM table_a AS A
fix_str: |
SELECT "a".col_1
FROM table_a
configs:
core:
dialect: exasol
test_pass_exasol_quoted_select_single_quote_table:
pass_str: |
SELECT "'""A""'".col_1
FROM table_a AS '''"A"'''
configs:
core:
dialect: exasol
test_pass_hive_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as `A`
configs:
core:
dialect: hive
test_pass_hive_quoted_select_naked_table:
pass_str: |
SELECT `a`.col1
FROM tab1 as A
configs:
core:
dialect: hive
test_pass_mysql_quoted_select_quoted_table:
pass_str: |
SELECT `nih`.`userID`
FROM `flight_notification_item_history` AS `nih`
configs:
core:
dialect: mysql
test_pass_mysql_naked_select_quoted_table:
pass_str: |
SELECT nih.`userID`
FROM `flight_notification_item_history` AS `nih`
configs:
core:
dialect: mysql
test_pass_mysql_quoted_select_naked_table:
pass_str: |
SELECT `nih`.`userID`
FROM `flight_notification_item_history` AS nih
configs:
core:
dialect: mysql
test_pass_oracle_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: oracle
test_fail_oracle_naked_select_double_quoted_table_wrong_case:
fail_str: |
SELECT a.col_1
FROM table_a AS "a"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
core:
dialect: oracle
test_pass_postgres_naked_select_double_quoted_table:
pass_str: |
SELECT A.col_1
FROM table_a AS "a"
configs:
core:
dialect: postgres
test_fail_postgres_naked_select_double_quoted_table:
fail_str: |
SELECT a.col_1
FROM table_a AS "A"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
core:
dialect: postgres
test_pass_postgres_quoted_select_naked_table:
pass_str: |
SELECT "a".col_1
FROM table_a AS a
configs:
core:
dialect: postgres
test_pass_postgres_quoted_select_single_quote_table:
pass_str: |
SELECT "A""".col_1
FROM table_a AS "A"""
configs:
core:
dialect: postgres
test_pass_redshift_naked_select_double_quoted_table:
pass_str: |
SELECT A.col_1
FROM table_a AS "a"
configs:
core:
dialect: redshift
test_fail_redshift_naked_select_double_quoted_table:
fail_str: |
SELECT a.col_1
FROM table_a AS "A"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
core:
dialect: redshift
test_pass_redshift_quoted_select_naked_table:
pass_str: |
SELECT "a".col_1
FROM table_a AS a
configs:
core:
dialect: redshift
test_pass_redshift_quoted_select_single_quote_table:
pass_str: |
SELECT "A""".col_1
FROM table_a AS "A"""
configs:
core:
dialect: redshift
test_pass_snowflake_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: snowflake
test_fail_snowflake_naked_select_double_quoted_table_wrong_case:
fail_str: |
SELECT a.col_1
FROM table_a AS "a"
fix_str: |
SELECT a.col_1
FROM table_a
configs:
core:
dialect: snowflake
test_pass_sparksql_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS `A`
configs:
core:
dialect: sparksql
test_pass_sparksql_quoted_select_naked_table:
pass_str: |
SELECT `a`.col_1
FROM table_a AS A
configs:
core:
dialect: sparksql
test_pass_sqlite_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as `a`
configs:
core:
dialect: sqlite
test_pass_sqlite_quoted_select_naked_table:
pass_str: |
SELECT `a`.col1
FROM tab1 as a
configs:
core:
dialect: sqlite
test_pass_sqlite_naked_select_quoted_table_subquery:
pass_str: |
SELECT col_1
FROM table_a AS `a`
WHERE NOT EXISTS (SELECT TRUE FROM table_b AS b WHERE a.col_4 = b.col_1)
configs:
core:
dialect: sqlite
test_pass_sqlite_quoted_select_naked_table_subquery:
pass_str: |
SELECT col_1
FROM table_a AS a
WHERE NOT EXISTS (SELECT TRUE FROM table_b AS b WHERE `a`.col_4 = b.col_1)
configs:
core:
dialect: sqlite
test_pass_sqlite_different_escaped_quotes:
pass_str: |
SELECT
"`'a""".id,
'`''a"'.id
FROM table_a AS ```'A"`
configs:
core:
dialect: sqlite
test_pass_teradata_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: teradata
test_pass_teradata_quoted_select_naked_table:
pass_str: |
SELECT "a".col_1
FROM table_a AS A
configs:
core:
dialect: teradata
test_pass_trino_naked_select_double_quoted_table:
pass_str: |
SELECT a.col_1
FROM table_a AS "A"
configs:
core:
dialect: trino
test_pass_trino_quoted_select_naked_table:
pass_str: |
SELECT "a".col_1
FROM table_a AS A
configs:
core:
dialect: trino
test_pass_tsql_naked_select_quoted_table:
pass_str: |
SELECT a.col1
FROM tab1 as [a]