databend-common-ast 0.0.2

SQL parser for Databend
Documentation
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
---------- Input ----------
create table a.b (c integer not null 1, b float(10))
---------- Output ---------
error: 
  --> SQL:1:38
  |
1 | create table a.b (c integer not null 1, b float(10))
  | ------                               ^ unexpected `1`, expecting `)`, `NULL`, `NOT`, `DEFAULT`, `GENERATED`, `AS`, `COMMENT`, or `,`
  | |                                     
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
create table a (c float(10))
---------- Output ---------
error: 
  --> SQL:1:24
  |
1 | create table a (c float(10))
  | ------                 ^ unexpected `(`, expecting `)`, `NULL`, `NOT`, `DEFAULT`, `GENERATED`, `AS`, `COMMENT`, or `,`
  | |                       
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
create table a (c varch)
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | create table a (c varch)
  | ------          - ^^^^^ unexpected `varch`, expecting `VARCHAR`, `CHAR`, `VARIANT`, `CHARACTER`, `VARBINARY`, `ARRAY`, `BINARY`, `MAP`, `DATE`, `STRING`, `FLOAT32`, `FLOAT64`, `DECIMAL`, `SMALLINT`, `DATETIME`, `NULLABLE`, `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT`, `DOUBLE`, `BITMAP`, `TUPLE`, `TIMESTAMP`, `LONGBLOB`, `MEDIUMBLOB`, `TINYBLOB`, `BLOB`, `TEXT`, `JSON`, or `GEOMETRY`
  | |               |  
  | |               while parsing `<column name> <type> [DEFAULT <expr>] [AS (<expr>) VIRTUAL] [AS (<expr>) STORED] [COMMENT '<comment>']`
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
create table a (c tuple())
---------- Output ---------
error: 
  --> SQL:1:25
  |
1 | create table a (c tuple())
  | ------          - ----- ^ unexpected `)`, expecting `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT32`, `FLOAT`, `FLOAT64`, `DOUBLE`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `DATETIME`, `TIMESTAMP`, `BINARY`, `VARBINARY`, `LONGBLOB`, `MEDIUMBLOB`, `TINYBLOB`, `BLOB`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `VARIANT`, `JSON`, `GEOMETRY`, `NULLABLE`, <Ident>, <LiteralString>, or `IDENTIFIER`
  | |               | |      
  | |               | while parsing type name
  | |               while parsing `<column name> <type> [DEFAULT <expr>] [AS (<expr>) VIRTUAL] [AS (<expr>) STORED] [COMMENT '<comment>']`
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
create table a (c decimal)
---------- Output ---------
error: 
  --> SQL:1:26
  |
1 | create table a (c decimal)
  | ------          - -------^ unexpected `)`, expecting `(`
  | |               | |       
  | |               | while parsing type name
  | |               while parsing `<column name> <type> [DEFAULT <expr>] [AS (<expr>) VIRTUAL] [AS (<expr>) STORED] [COMMENT '<comment>']`
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
create table a (b tuple(c int, uint64));
---------- Output ---------
error: 
  --> SQL:1:38
  |
1 | create table a (b tuple(c int, uint64));
  | ------          - -----              ^ unexpected `)`, expecting `BOOLEAN`, `BOOL`, `UINT8`, `TINYINT`, `UINT16`, `SMALLINT`, `UINT32`, `INT`, `INTEGER`, `UINT64`, `UNSIGNED`, `BIGINT`, `INT8`, `INT16`, `INT32`, `INT64`, `SIGNED`, `FLOAT32`, `FLOAT`, `FLOAT64`, `DOUBLE`, `DECIMAL`, `ARRAY`, `MAP`, `BITMAP`, `TUPLE`, `DATE`, `DATETIME`, `TIMESTAMP`, `BINARY`, `VARBINARY`, `LONGBLOB`, `MEDIUMBLOB`, `TINYBLOB`, `BLOB`, `STRING`, `VARCHAR`, `CHAR`, `CHARACTER`, `TEXT`, `VARIANT`, `JSON`, `GEOMETRY`, or `NULLABLE`
  | |               | |                   
  | |               | while parsing TUPLE(<name> <type>, ...)
  | |               | while parsing type name
  | |               while parsing `<column name> <type> [DEFAULT <expr>] [AS (<expr>) VIRTUAL] [AS (<expr>) STORED] [COMMENT '<comment>']`
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
CREATE TABLE t(c1 NULLABLE(int) NOT NULL);
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | CREATE TABLE t(c1 NULLABLE(int) NOT NULL);
  | ------         -- ^^^^^^^^ ambiguous NOT NULL constraint
  | |              |   
  | |              while parsing `<column name> <type> [DEFAULT <expr>] [AS (<expr>) VIRTUAL] [AS (<expr>) STORED] [COMMENT '<comment>']`
  | while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`


---------- Input ----------
drop table if a.b
---------- Output ---------
error: 
  --> SQL:1:15
  |
1 | drop table if a.b
  | ----          ^ unexpected `a`, expecting `EXISTS`
  | |              
  | while parsing `DROP TABLE [IF EXISTS] [<database>.]<table>`


---------- Input ----------
truncate table a.b.c.d
---------- Output ---------
error: 
  --> SQL:1:21
  |
1 | truncate table a.b.c.d
  |                     ^ unexpected `.`, expecting `FORMAT` or `;`


---------- Input ----------
truncate a
---------- Output ---------
error: 
  --> SQL:1:10
  |
1 | truncate a
  | -------- ^ unexpected `a`, expecting `TABLE`
  | |         
  | while parsing `TRUNCATE TABLE [<database>.]<table>`


---------- Input ----------
drop a
---------- Output ---------
error: 
  --> SQL:1:6
  |
1 | drop a
  |      ^ unexpected `a`, expecting `TASK`, `TABLE`, `MASKING`, `CATALOG`, `DATABASE`, `PASSWORD`, `AGGREGATING`, `SCHEMA`, `NETWORK`, `VIEW`, `INVERTED`, `VIRTUAL`, `SEQUENCE`, `USER`, `ROLE`, `FUNCTION`, `STAGE`, `FILE`, `SHARE`, `STREAM`, `PIPE`, `NOTIFICATION`, or `CONNECTION`


---------- Input ----------
insert into t format
---------- Output ---------
error: 
  --> SQL:1:15
  |
1 | insert into t format
  | ------        ^^^^^^ unexpected `format`, expecting `FROM`, `ORDER`, `LIMIT`, `OFFSET`, `IGNORE_RESULT`, `WITH`, `VALUES`, `EXCEPT`, `SELECT`, `INTERSECT`, `(`, `UNION`, or `.`
  | |              
  | while parsing `INSERT INTO [TABLE] <table> [(<column>, ...)] (FORMAT <format> | VALUES <values> | <query>)`


---------- Input ----------
show tables format
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | show tables format
  |                   ^ unexpected end of input, expecting <Ident>, <LiteralString>, or `IDENTIFIER`


---------- Input ----------
alter database system x rename to db
---------- Output ---------
error: 
  --> SQL:1:23
  |
1 | alter database system x rename to db
  | -----                 ^ unexpected `x`, expecting `RENAME` or `.`
  | |                      
  | while parsing `ALTER DATABASE [IF EXISTS] <action>`


---------- Input ----------
create user 'test-e' identified bi 'password';
---------- Output ---------
error: 
  --> SQL:1:33
  |
1 | create user 'test-e' identified bi 'password';
  |                                 ^^ unexpected `bi`, expecting `BY`, `WITH`, `FORMAT`, or `;`


---------- Input ----------
create user 'test-e'@'localhost' identified by 'password';
---------- Output ---------
error: 
  --> SQL:1:22
  |
1 | create user 'test-e'@'localhost' identified by 'password';
  | ------               ^^^^^^^^^^^ unexpected `'localhost'`, expecting `'%'` or `IDENTIFIED`
  | |                     
  | while parsing `CREATE [OR REPLACE] USER [IF NOT EXISTS] '<username>'@'hostname' IDENTIFIED [WITH <auth_type>] [BY <password>] [WITH <user_option>, ...]`


---------- Input ----------
drop usar if exists 'test-j';
---------- Output ---------
error: 
  --> SQL:1:6
  |
1 | drop usar if exists 'test-j';
  |      ^^^^ unexpected `usar`, expecting `USER`, `SHARE`, `STREAM`, `STAGE`, `PASSWORD`, `AGGREGATING`, `ROLE`, `TABLE`, `SCHEMA`, `NETWORK`, `VIRTUAL`, `CATALOG`, `DATABASE`, `INVERTED`, `FUNCTION`, `TASK`, `NOTIFICATION`, `MASKING`, `SEQUENCE`, `VIEW`, `FILE`, `PIPE`, or `CONNECTION`


---------- Input ----------
alter user 'test-e' identifies by 'new-password';
---------- Output ---------
error: 
  --> SQL:1:21
  |
1 | alter user 'test-e' identifies by 'new-password';
  |                     ^^^^^^^^^^ unexpected `identifies`, expecting `IDENTIFIED`, `WITH`, `FORMAT`, `@`, or `;`


---------- Input ----------
create role 'test'@'%';
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | create role 'test'@'%';
  |                   ^ unexpected `@`, expecting `FORMAT` or `;`


---------- Input ----------
drop role 'test'@'%';
---------- Output ---------
error: 
  --> SQL:1:17
  |
1 | drop role 'test'@'%';
  |                 ^ unexpected `@`, expecting `FORMAT` or `;`


---------- Input ----------
SHOW GRANT FOR ROLE 'role1';
---------- Output ---------
error: 
  --> SQL:1:6
  |
1 | SHOW GRANT FOR ROLE 'role1';
  |      ^^^^^ unexpected `GRANT`, expecting `GRANTS`, `CREATE`, `NETWORK`, `VIRTUAL`, `CATALOGS`, `STREAMS`, `FUNCTIONS`, `DATABASES`, `CONNECTIONS`, `TABLE_FUNCTIONS`, `DROP`, `TABLE`, `ROLES`, `SHARE`, `TASKS`, `INDEXES`, `COLUMNS`, `PASSWORD`, `PROCESSLIST`, `STAGES`, `TABLES`, `SHARES`, `ENGINES`, `METRICS`, `SETTINGS`, `LOCKS`, `SCHEMAS`, `FIELDS`, `VIEWS`, `USERS`, `USER`, `FILE`, or `FULL`


---------- Input ----------
GRANT ROLE 'test' TO ROLE test-user;
---------- Output ---------
error: 
  --> SQL:1:31
  |
1 | GRANT ROLE 'test' TO ROLE test-user;
  |                               ^ unexpected `-`, expecting `FORMAT` or `;`


---------- Input ----------
GRANT SELECT, ALL PRIVILEGES, CREATE ON * TO 'test-grant';
---------- Output ---------
error: 
  --> SQL:1:15
  |
1 | GRANT SELECT, ALL PRIVILEGES, CREATE ON * TO 'test-grant';
  | ----- ------  ^^^ unexpected `ALL`, expecting `ALTER`, `SELECT`, `DELETE`, `USAGE`, `INSERT`, `UPDATE`, `SUPER`, `CREATE`, `DROP`, `GRANT`, or `SET`
  | |     |        
  | |     while parsing <privileges> ON <privileges_level>
  | while parsing `GRANT { ROLE <role_name> | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON <privileges_level> } TO { [ROLE <role_name>] | [USER] <user> }`


---------- Input ----------
GRANT SELECT, CREATE ON *.c TO 'test-grant';
---------- Output ---------
error: 
  --> SQL:1:27
  |
1 | GRANT SELECT, CREATE ON *.c TO 'test-grant';
  | -----                     ^ unexpected `c`, expecting `TO` or `*`
  | |                          
  | while parsing `GRANT { ROLE <role_name> | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON <privileges_level> } TO { [ROLE <role_name>] | [USER] <user> }`


---------- Input ----------
GRANT select ON UDF a TO 'test-grant';
---------- Output ---------
error: 
  --> SQL:1:17
  |
1 | GRANT select ON UDF a TO 'test-grant';
  |                 ^^^ unexpected `UDF`, expecting `IDENTIFIER`, <Ident>, `FALSE`, `DATABASE`, `*`, <LiteralString>, <LiteralInteger>, <MySQLLiteralHex>, <PGLiteralHex>, `TRUE`, or `TABLE`


---------- Input ----------
REVOKE SELECT, CREATE, ALL PRIVILEGES ON * FROM 'test-grant';
---------- Output ---------
error: 
  --> SQL:1:24
  |
1 | REVOKE SELECT, CREATE, ALL PRIVILEGES ON * FROM 'test-grant';
  | ------ ------          ^^^ unexpected `ALL`, expecting `ALTER`, `SELECT`, `DELETE`, `USAGE`, `INSERT`, `UPDATE`, `SUPER`, `CREATE`, `DROP`, `GRANT`, or `SET`
  | |      |                
  | |      while parsing <privileges> ON <privileges_level>
  | while parsing `REVOKE { ROLE <role_name> | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON <privileges_level> } FROM { [ROLE <role_name>] | [USER] <user> }`


---------- Input ----------
REVOKE SELECT, CREATE ON * TO 'test-grant';
---------- Output ---------
error: 
  --> SQL:1:28
  |
1 | REVOKE SELECT, CREATE ON * TO 'test-grant';
  | ------                     ^^ unexpected `TO`, expecting `FROM` or `.`
  | |                           
  | while parsing `REVOKE { ROLE <role_name> | schemaObjectPrivileges | ALL [ PRIVILEGES ] ON <privileges_level> } FROM { [ROLE <role_name>] | [USER] <user> }`


---------- Input ----------
COPY INTO mytable FROM 's3://bucket' CONECTION= ();
---------- Output ---------
error: 
  --> SQL:1:38
  |
1 | COPY INTO mytable FROM 's3://bucket' CONECTION= ();
  |                                      ^^^^^^^^^ unexpected `CONECTION`, expecting `CONNECTION`, `ON_ERROR`, `RETURN_FAILED_ONLY`, `LOCATION_PREFIX`, `FORMAT`, `VALIDATION_MODE`, `FORCE`, `PATTERN`, `FILES`, `PURGE`, `SIZE_LIMIT`, `FILE_FORMAT`, `MAX_FILES`, `DISABLE_VARIANT_CHECK`, `SPLIT_SIZE`, or `;`


---------- Input ----------
COPY INTO mytable FROM @mystage CONNECTION = ();
---------- Output ---------
error: 
  --> SQL:1:33
  |
1 | COPY INTO mytable FROM @mystage CONNECTION = ();
  |                                 ^^^^^^^^^^ unexpected `CONNECTION`, expecting `ON_ERROR`, `RETURN_FAILED_ONLY`, `FORMAT`, `FORCE`, `FILES`, `PURGE`, `SIZE_LIMIT`, `FILE_FORMAT`, `VALIDATION_MODE`, `DISABLE_VARIANT_CHECK`, `PATTERN`, `MAX_FILES`, `SPLIT_SIZE`, or `;`


---------- Input ----------
CALL system$test
---------- Output ---------
error: 
  --> SQL:1:17
  |
1 | CALL system$test
  | ----            ^ unexpected end of input, expecting `(`
  | |               
  | while parsing `CALL <procedure_name>(<parameter>, ...)`


---------- Input ----------
CALL system$test(a
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | CALL system$test(a
  | ----              ^ unexpected end of input, expecting `)` or `,`
  | |                 
  | while parsing `CALL <procedure_name>(<parameter>, ...)`


---------- Input ----------
show settings ilike 'enable%'
---------- Output ---------
error: 
  --> SQL:1:15
  |
1 | show settings ilike 'enable%'
  |               ^^^^^ unexpected `ilike`, expecting `LIKE`, `LIMIT`, `WHERE`, `FORMAT`, or `;`


---------- Input ----------
PRESIGN INVALID @my_stage/path/to/file
---------- Output ---------
error: 
  --> SQL:1:9
  |
1 | PRESIGN INVALID @my_stage/path/to/file
  | ------- ^^^^^^^ unexpected `INVALID`, expecting `DOWNLOAD`, <LiteralString>, `UPLOAD`, or `LiteralAtString`
  | |        
  | while parsing `PRESIGN [{DOWNLOAD | UPLOAD}] <location> [EXPIRE = 3600]`


---------- Input ----------
SELECT c a as FROM t
---------- Output ---------
error: 
  --> SQL:1:12
  |
1 | SELECT c a as FROM t
  |            ^^ an alias without `AS` keyword has already been defined before this one, please remove one of them


---------- Input ----------
SELECT c a as b FROM t
---------- Output ---------
error: 
  --> SQL:1:12
  |
1 | SELECT c a as b FROM t
  |            ^^ an alias without `AS` keyword has already been defined before this one, please remove one of them


---------- Input ----------
SELECT top -1 c a as b FROM t
---------- Output ---------
error: 
  --> SQL:1:12
  |
1 | SELECT top -1 c a as b FROM t
  | ------ --- ^ expecting a literal number after keyword `TOP`, if you were referring to a column with name `top`, please quote it like `"top"`
  | |      |    
  | |      while parsing TOP <limit>
  | while parsing `SELECT ...`


---------- Input ----------
SELECT top c a as b FROM t
---------- Output ---------
error: 
  --> SQL:1:12
  |
1 | SELECT top c a as b FROM t
  | ------ --- ^ expecting a literal number after keyword `TOP`, if you were referring to a column with name `top`, please quote it like `"top"`
  | |      |    
  | |      while parsing TOP <limit>
  | while parsing `SELECT ...`


---------- Input ----------
SELECT * FROM t GROUP BY GROUPING SETS a, b
---------- Output ---------
error: 
  --> SQL:1:35
  |
1 | SELECT * FROM t GROUP BY GROUPING SETS a, b
  |                                   ^^^^ unexpected `SETS`, expecting `SELECT`, `INTERSECT`, `WITH`, `EXCEPT`, `VALUES`, `OFFSET`, `IGNORE_RESULT`, `,`, `HAVING`, `WINDOW`, `QUALIFY`, `(`, `UNION`, `FROM`, `ORDER`, `LIMIT`, `FORMAT`, or `;`


---------- Input ----------
SELECT * FROM t GROUP BY GROUPING SETS ()
---------- Output ---------
error: 
  --> SQL:1:41
  |
1 | SELECT * FROM t GROUP BY GROUPING SETS ()
  | ------                                  ^ unexpected `)`, expecting `(`, `IS`, `IN`, `EXISTS`, `BETWEEN`, `+`, `-`, `*`, `/`, `//`, `DIV`, `%`, `||`, `<->`, `>`, `<`, `>=`, `<=`, `=`, `<>`, `!=`, `^`, `AND`, `OR`, `XOR`, `LIKE`, `NOT`, `REGEXP`, `RLIKE`, `SOUNDS`, <BitWiseOr>, <BitWiseAnd>, <BitWiseXor>, <ShiftLeft>, <ShiftRight>, `->`, `->>`, `#>`, `#>>`, `?`, `?|`, `?&`, `@>`, `<@`, `@?`, `@@`, `#-`, <Factorial>, <SquareRoot>, <BitWiseNot>, <CubeRoot>, <Abs>, `CAST`, `TRY_CAST`, `DATE_ADD`, `DATE_SUB`, `DATE_TRUNC`, `DATE`, `TIMESTAMP`, `INTERVAL`, or 29 more ...
  | |                                        
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb limit 10 order by bb;
---------- Output ---------
error: 
  --> SQL:1:30
  |
1 | select * from aa.bb limit 10 order by bb;
  | ------                       ^^^^^ ORDER BY must appear before LIMIT
  | |                             
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb offset 10 order by bb;
---------- Output ---------
error: 
  --> SQL:1:31
  |
1 | select * from aa.bb offset 10 order by bb;
  | ------                        ^^^^^ ORDER BY must appear before OFFSET
  | |                              
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb offset 10 limit 1;
---------- Output ---------
error: 
  --> SQL:1:31
  |
1 | select * from aa.bb offset 10 limit 1;
  | ------                        ^^^^^ LIMIT must appear before OFFSET
  | |                              
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb order by a order by b;
---------- Output ---------
error: 
  --> SQL:1:32
  |
1 | select * from aa.bb order by a order by b;
  | ------                         ^^^^^ duplicated ORDER BY clause
  | |                               
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb offset 10 offset 20;
---------- Output ---------
error: 
  --> SQL:1:31
  |
1 | select * from aa.bb offset 10 offset 20;
  | ------                        ^^^^^^ duplicated OFFSET clause
  | |                              
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb limit 10 limit 20;
---------- Output ---------
error: 
  --> SQL:1:30
  |
1 | select * from aa.bb limit 10 limit 20;
  | ------                       ^^^^^ duplicated LIMIT clause
  | |                             
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb limit 10,2 offset 2;
---------- Output ---------
error: 
  --> SQL:1:32
  |
1 | select * from aa.bb limit 10,2 offset 2;
  | ------                         ^^^^^^ LIMIT n,m should not appear OFFSET
  | |                               
  | while parsing `SELECT ...`


---------- Input ----------
select * from aa.bb limit 10,2,3;
---------- Output ---------
error: 
  --> SQL:1:21
  |
1 | select * from aa.bb limit 10,2,3;
  | ------              ^^^^^ [LIMIT n OFFSET m] or [LIMIT n,m]
  | |                    
  | while parsing `SELECT ...`


---------- Input ----------
with a as (select 1) with b as (select 2) select * from aa.bb;
---------- Output ---------
error: 
  --> SQL:1:43
  |
1 | with a as (select 1) with b as (select 2) select * from aa.bb;
  | ----                                      ^^^^^^ duplicated WITH clause
  | |                                          
  | while parsing `SELECT ...`


---------- Input ----------
with as t2(tt) as (select a from t) select t2.tt from t2
---------- Output ---------
error: 
  --> SQL:1:6
  |
1 | with as t2(tt) as (select a from t) select t2.tt from t2
  | ---- ^^ unexpected `as`, expecting <LiteralString>, <Ident>, `IDENTIFIER`, or `RECURSIVE`
  | |     
  | while parsing `SELECT ...`


---------- Input ----------
copy into t1 from "" FILE
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
select $1 from @data/csv/books.csv (file_format => 'aa' bad_arg => 'x', pattern => 'bb')
---------- Output ---------
error: 
  --> SQL:1:57
  |
1 | select $1 from @data/csv/books.csv (file_format => 'aa' bad_arg => 'x', pattern => 'bb')
  | ------                                                  ^^^^^^^ unexpected `bad_arg`, expecting `PATTERN`, `FILE_FORMAT`, `)`, `,`, `FILES`, or `CONNECTION`
  | |                                                        
  | while parsing `SELECT ...`


---------- Input ----------
copy into t1 from "" FILE_FORMAT
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
copy into t1 from "" FILE_FORMAT = 
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT = 
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
copy into t1 from "" FILE_FORMAT = (
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT = (
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
copy into t1 from "" FILE_FORMAT = (TYPE
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT = (TYPE
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
copy into t1 from "" FILE_FORMAT = (TYPE =
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT = (TYPE =
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
copy into t1 from "" FILE_FORMAT = (TYPE =
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | copy into t1 from "" FILE_FORMAT = (TYPE =
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
COPY INTO t1 FROM "" PATTERN = '.*[.]csv' FILE_FORMAT = (type = TSV field_delimiter = '\t' skip_headerx = 0);
---------- Output ---------
error: 
  --> SQL:1:19
  |
1 | COPY INTO t1 FROM "" PATTERN = '.*[.]csv' FILE_FORMAT = (type = TSV field_delimiter = '\t' skip_headerx = 0);
  | ----              ^^ unexpected `""`, expecting <LiteralString>, `LiteralAtString`, or `(`
  | |                  
  | while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`


---------- Input ----------
COPY INTO mytable
                FROM @my_stage
                FILE_FORMAT = (
                    type = CSV,
                    error_on_column_count_mismatch = 1
                )
---------- Output ---------
error: 
  --> SQL:5:54
  |
1 | COPY INTO mytable
  | ---- while parsing `COPY
                INTO { [<database_name>.]<table_name> { ( <columns> ) } }
                FROM { internalStage | externalStage | externalLocation | ( <query> ) }
                [ FILE_FORMAT = ( { TYPE = { CSV | JSON | PARQUET | TSV } [ formatTypeOptions ] } ) ]
                [ FILES = ( '<file_name>' [ , '<file_name>' ] [ , ... ] ) ]
                [ PATTERN = '<regex_pattern>' ]
                [ VALIDATION_MODE = RETURN_ROWS ]
                [ copyOptions ]`
2 |                 FROM @my_stage
3 |                 FILE_FORMAT = (
4 |                     type = CSV,
5 |                     error_on_column_count_mismatch = 1
  |                                                      ^ unexpected `1`, expecting `TRUE` or `FALSE`


---------- Input ----------
CREATE CONNECTION IF NOT EXISTS my_conn
---------- Output ---------
error: 
  --> SQL:1:40
  |
1 | CREATE CONNECTION IF NOT EXISTS my_conn
  | ------                                 ^ unexpected end of input, expecting `STORAGE_TYPE`
  | |                                      
  | while parsing `CREATE [OR REPLACE] CONNECTION [IF NOT EXISTS] <connection_name> STORAGE_TYPE = <type> <storage_configs>`


---------- Input ----------
select $0 from t1
---------- Output ---------
error: 
  --> SQL:1:8
  |
1 | select $0 from t1
  | ------ ^^
  | |      |
  | |      column position must be greater than 0
  | |      while parsing expression
  | |      while parsing <column>
  | while parsing `SELECT ...`


---------- Input ----------
GRANT OWNERSHIP, SELECT ON d20_0014.* TO ROLE 'd20_0015_owner';
---------- Output ---------
error: 
  --> SQL:1:16
  |
1 | GRANT OWNERSHIP, SELECT ON d20_0014.* TO ROLE 'd20_0015_owner';
  | -----          ^ unexpected `,`, expecting `ON`
  | |               
  | while parsing GRANT OWNERSHIP ON <privileges_level> TO ROLE <role_name>


---------- Input ----------
GRANT OWNERSHIP ON d20_0014.* TO USER A;
---------- Output ---------
error: 
  --> SQL:1:34
  |
1 | GRANT OWNERSHIP ON d20_0014.* TO USER A;
  | -----                            ^^^^ unexpected `USER`, expecting `ROLE`
  | |                                 
  | while parsing GRANT OWNERSHIP ON <privileges_level> TO ROLE <role_name>


---------- Input ----------
REVOKE OWNERSHIP, SELECT ON d20_0014.* FROM ROLE 'd20_0015_owner';
---------- Output ---------
error: 
  --> SQL:1:8
  |
1 | REVOKE OWNERSHIP, SELECT ON d20_0014.* FROM ROLE 'd20_0015_owner';
  |        ^^^^^^^^^ unexpected `OWNERSHIP`, expecting `INSERT`, `ALTER`, `SUPER`, `ROLE`, `WRITE`, `SET`, `SELECT`, `UPDATE`, `DELETE`, `REFERENCE_USAGE`, `DROP`, `READ`, `USAGE`, `GRANT`, `CREATE`, or `ALL`


---------- Input ----------
REVOKE OWNERSHIP ON d20_0014.* FROM USER A;
---------- Output ---------
error: 
  --> SQL:1:8
  |
1 | REVOKE OWNERSHIP ON d20_0014.* FROM USER A;
  |        ^^^^^^^^^ unexpected `OWNERSHIP`, expecting `INSERT`, `ALTER`, `SUPER`, `ROLE`, `WRITE`, `SET`, `SELECT`, `UPDATE`, `DELETE`, `REFERENCE_USAGE`, `DROP`, `READ`, `USAGE`, `GRANT`, `CREATE`, or `ALL`


---------- Input ----------
REVOKE OWNERSHIP ON d20_0014.* FROM ROLE A;
---------- Output ---------
error: 
  --> SQL:1:8
  |
1 | REVOKE OWNERSHIP ON d20_0014.* FROM ROLE A;
  |        ^^^^^^^^^ unexpected `OWNERSHIP`, expecting `INSERT`, `ALTER`, `SUPER`, `ROLE`, `WRITE`, `SET`, `SELECT`, `UPDATE`, `DELETE`, `REFERENCE_USAGE`, `DROP`, `READ`, `USAGE`, `GRANT`, `CREATE`, or `ALL`


---------- Input ----------
GRANT OWNERSHIP ON *.* TO ROLE 'd20_0015_owner';
---------- Output ---------
error: 
  --> SQL:1:21
  |
1 | GRANT OWNERSHIP ON *.* TO ROLE 'd20_0015_owner';
  | -----               ^ unexpected `.`, expecting `TO`
  | |                    
  | while parsing GRANT OWNERSHIP ON <privileges_level> TO ROLE <role_name>


---------- Input ----------
CREATE FUNCTION IF NOT EXISTS isnotempty AS(p) -> not(is_null(p)
---------- Output ---------
error: 
  --> SQL:1:65
  |
1 | CREATE FUNCTION IF NOT EXISTS isnotempty AS(p) -> not(is_null(p)
  | ------                                   --       ----          ^ unexpected end of input, expecting `)`, `OVER`, `(`, `IS`, `NOT`, `IN`, `EXISTS`, `BETWEEN`, `+`, `-`, `*`, `/`, `//`, `DIV`, `%`, `||`, `<->`, `>`, `<`, `>=`, `<=`, `=`, `<>`, `!=`, `^`, `AND`, `OR`, `XOR`, `LIKE`, `REGEXP`, `RLIKE`, `SOUNDS`, <BitWiseOr>, <BitWiseAnd>, <BitWiseXor>, <ShiftLeft>, <ShiftRight>, `->`, `->>`, `#>`, `#>>`, `?`, `?|`, `?&`, `@>`, `<@`, `@?`, `@@`, `#-`, <Factorial>, <SquareRoot>, <BitWiseNot>, <CubeRoot>, <Abs>, `CAST`, `TRY_CAST`, `DATE_ADD`, `DATE_SUB`, `DATE_TRUNC`, `DATE`, or 32 more ...
  | |                                        |        |  |          
  | |                                        |        |  while parsing `(<expr> [, ...])`
  | |                                        |        while parsing expression
  | |                                        while parsing AS (<parameter>, ...) -> <definition expr>
  | while parsing `CREATE [OR REPLACE] FUNCTION [IF NOT EXISTS] <name> {AS (<parameter>, ...) -> <definition expr> | (<arg_type>, ...) RETURNS <return_type> LANGUAGE <language> HANDLER=<handler> ADDRESS=<udf_server_address>} [DESC = <description>]`


---------- Input ----------
drop table :a
---------- Output ---------
error: 
  --> SQL:1:12
  |
1 | drop table :a
  | ----       ^ unexpected `:`, expecting <Ident>, <LiteralString>, `IDENTIFIER`, or `IF`
  | |           
  | while parsing `DROP TABLE [IF EXISTS] [<database>.]<table>`


---------- Input ----------
drop table IDENTIFIER(a)
---------- Output ---------
error: 
  --> SQL:1:23
  |
1 | drop table IDENTIFIER(a)
  | ----                  ^ unexpected `a`, expecting `:`
  | |                      
  | while parsing `DROP TABLE [IF EXISTS] [<database>.]<table>`


---------- Input ----------
drop table IDENTIFIER(:a)
---------- Output ---------
error: 
  --> SQL:1:23
  |
1 | drop table IDENTIFIER(:a)
  | ----                  ^ variable is only available in SQL template
  | |                      
  | while parsing `DROP TABLE [IF EXISTS] [<database>.]<table>`


---------- Input ----------
SHOW GRANTS ON task t1;
---------- Output ---------
error: 
  --> SQL:1:16
  |
1 | SHOW GRANTS ON task t1;
  |                ^^^^ unexpected `task`, expecting `STAGE`, `TABLE`, `DATABASE`, or `UDF`