1[
2  {
3    "input": "",
4    "output": ""
5  },
6  {
7    "input": " ",
8    "output": ""
9  },
10  {
11    "input": "SELECT * FROM foo.bar",
12    "output": "SELECT FROM foo.bar"
13  },
14  {
15    "input": "SELECT * FROM foo.bar.baz",
16    "output": "SELECT FROM foo.bar.baz"
17  },
18  {
19    "input": "SELECT * FROM `foo.bar`",
20    "output": "SELECT FROM foo.bar"
21  },
22  {
23    "input": "SELECT * FROM \"foo.bar\"",
24    "output": "SELECT FROM foo.bar"
25  },
26  {
27    "input": "SELECT * FROM [foo.bar]",
28    "output": "SELECT FROM foo.bar"
29  },
30  {
31    "input": "SELECT (x, y) FROM foo,bar,baz",
32    "output": "SELECT FROM foo"
33  },
34  {
35    "input": "SELECT * FROM foo JOIN bar",
36    "output": "SELECT FROM foo"
37  },
38  {
39    "input": "SELECT * FROM dollar$bill",
40    "output": "SELECT FROM dollar$bill"
41  },
42  {
43    "input": "SELECT id FROM \"myta\n-æøåble\" WHERE id = 2323",
44    "output": "SELECT FROM myta\n-æøåble"
45  },
46  {
47    "input": "SELECT * FROM foo-- abc\n./*def*/bar",
48    "output": "SELECT FROM foo.bar"
49  },
50  {
51    "comment": "We capture the first table of the outermost select statement",
52    "input": "SELECT *,(SELECT COUNT(*) FROM table2 WHERE table2.field1 = table1.id) AS count FROM table1 WHERE table1.field1 = 'value'",
53    "output": "SELECT FROM table1"
54  },
55  {
56    "comment": "If the outermost select operates on derived tables, then we just return 'SELECT' (i.e. the fallback)",
57    "input": "SELECT * FROM (SELECT foo FROM bar) AS foo_bar",
58    "output": "SELECT"
59  },
60  {
61    "input": "DELETE FROM foo.bar WHERE baz=1",
62    "output": "DELETE FROM foo.bar"
63  },
64  {
65    "input": "UPDATE IGNORE foo.bar SET bar=1 WHERE baz=2",
66    "output": "UPDATE foo.bar"
67  },
68  {
69    "input": "UPDATE ONLY foo AS bar SET baz=1",
70    "output": "UPDATE foo"
71  },
72  {
73    "input": "INSERT INTO foo.bar (col) VALUES(?)",
74    "output": "INSERT INTO foo.bar"
75  },
76  {
77    "input": "INSERT LOW_PRIORITY IGNORE INTO foo.bar (col) VALUES(?)",
78    "output": "INSERT INTO foo.bar"
79  },
80  {
81    "input": "CALL foo(bar, 123)",
82    "output": "CALL foo"
83  },
84  {
85    "comment": "For DDL we only capture the first token",
86    "input": "ALTER TABLE foo ADD ()",
87    "output": "ALTER"
88  },
89  {
90    "input": "CREATE TABLE foo ...",
91    "output": "CREATE"
92  },
93  {
94    "input": "DROP TABLE foo",
95    "output": "DROP"
96  },
97  {
98    "input": "SAVEPOINT x_asd1234",
99    "output": "SAVEPOINT"
100  },
101  {
102    "input": "BEGIN",
103    "output": "BEGIN"
104  },
105  {
106    "input": "COMMIT",
107    "output": "COMMIT"
108  },
109  {
110    "input": "ROLLBACK",
111    "output": "ROLLBACK"
112  },
113  {
114    "comment": "For broken statements we only capture the first token",
115    "input": "SELECT * FROM (SELECT EOF",
116    "output": "SELECT"
117  },
118  {
119    "input": "SELECT 'neverending literal FROM (SELECT * FROM ...",
120    "output": "SELECT"
121  },
122  {
123    "input": "INSERT COIN TO PLAY",
124    "output": "INSERT"
125  },
126  {
127    "input": "INSERT $2 INTO",
128    "output": "INSERT"
129  },
130  {
131    "input": "UPDATE 99",
132    "output": "UPDATE"
133  },
134  {
135    "input": "DELETE 99",
136    "output": "DELETE"
137  },
138  {
139    "input": "DELETE FROM",
140    "output": "DELETE"
141  },
142  {
143    "input": "CALL",
144    "output": "CALL"
145  }
146]
147