Skip to content

Commit 6e14f3e

Browse files
committed
Add unit test for ALTER TABLE COALESCE PARTITION
1 parent 26eb1f2 commit 6e14f3e

3 files changed

Lines changed: 176 additions & 0 deletions

File tree

tests/Parser/AlterStatementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function alterProvider(): array
4343
['parser/parseAlterTableRenameIndex'],
4444
['parser/parseAlterTablePartitionByRange1'],
4545
['parser/parseAlterTablePartitionByRange2'],
46+
['parser/parseAlterTableCoalescePartition'],
4647
['parser/parseAlterWithInvisible'],
4748
['parser/parseAlterTableCharacterSet1'],
4849
['parser/parseAlterTableCharacterSet2'],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
{
2+
"query": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;",
6+
"len": 44,
7+
"last": 44,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "ALTER",
14+
"value": "ALTER",
15+
"keyword": "ALTER",
16+
"type": 1,
17+
"flags": 3,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": " ",
23+
"value": " ",
24+
"keyword": null,
25+
"type": 3,
26+
"flags": 0,
27+
"position": 5
28+
},
29+
{
30+
"@type": "PhpMyAdmin\\SqlParser\\Token",
31+
"token": "TABLE",
32+
"value": "TABLE",
33+
"keyword": "TABLE",
34+
"type": 1,
35+
"flags": 3,
36+
"position": 6
37+
},
38+
{
39+
"@type": "PhpMyAdmin\\SqlParser\\Token",
40+
"token": " ",
41+
"value": " ",
42+
"keyword": null,
43+
"type": 3,
44+
"flags": 0,
45+
"position": 11
46+
},
47+
{
48+
"@type": "PhpMyAdmin\\SqlParser\\Token",
49+
"token": "`MY_TABLE`",
50+
"value": "MY_TABLE",
51+
"keyword": null,
52+
"type": 8,
53+
"flags": 2,
54+
"position": 12
55+
},
56+
{
57+
"@type": "PhpMyAdmin\\SqlParser\\Token",
58+
"token": " ",
59+
"value": " ",
60+
"keyword": null,
61+
"type": 3,
62+
"flags": 0,
63+
"position": 22
64+
},
65+
{
66+
"@type": "PhpMyAdmin\\SqlParser\\Token",
67+
"token": "COALESCE PARTITION",
68+
"value": "COALESCE PARTITION",
69+
"keyword": "COALESCE PARTITION",
70+
"type": 1,
71+
"flags": 7,
72+
"position": 23
73+
},
74+
{
75+
"@type": "PhpMyAdmin\\SqlParser\\Token",
76+
"token": " ",
77+
"value": " ",
78+
"keyword": null,
79+
"type": 3,
80+
"flags": 0,
81+
"position": 41
82+
},
83+
{
84+
"@type": "PhpMyAdmin\\SqlParser\\Token",
85+
"token": "2",
86+
"value": 2,
87+
"keyword": null,
88+
"type": 6,
89+
"flags": 0,
90+
"position": 42
91+
},
92+
{
93+
"@type": "PhpMyAdmin\\SqlParser\\Token",
94+
"token": ";",
95+
"value": ";",
96+
"keyword": null,
97+
"type": 9,
98+
"flags": 0,
99+
"position": 43
100+
},
101+
{
102+
"@type": "PhpMyAdmin\\SqlParser\\Token",
103+
"token": null,
104+
"value": null,
105+
"keyword": null,
106+
"type": 9,
107+
"flags": 0,
108+
"position": null
109+
}
110+
],
111+
"count": 11,
112+
"idx": 11
113+
},
114+
"delimiter": ";",
115+
"delimiterLen": 1,
116+
"strict": false,
117+
"errors": []
118+
},
119+
"parser": {
120+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
121+
"list": {
122+
"@type": "@1"
123+
},
124+
"statements": [
125+
{
126+
"@type": "PhpMyAdmin\\SqlParser\\Statements\\AlterStatement",
127+
"table": {
128+
"@type": "PhpMyAdmin\\SqlParser\\Components\\Expression",
129+
"database": null,
130+
"table": "MY_TABLE",
131+
"column": null,
132+
"expr": "`MY_TABLE`",
133+
"alias": null,
134+
"function": null,
135+
"subquery": null
136+
},
137+
"altered": [
138+
{
139+
"@type": "PhpMyAdmin\\SqlParser\\Components\\AlterOperation",
140+
"options": {
141+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
142+
"options": {
143+
"1": {
144+
"name": "COALESCE PARTITION",
145+
"equals": false,
146+
"expr": "2",
147+
"value": "2"
148+
}
149+
}
150+
},
151+
"field": null,
152+
"partitions": null,
153+
"unknown": []
154+
}
155+
],
156+
"options": {
157+
"@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray",
158+
"options": {
159+
"3": "TABLE"
160+
}
161+
},
162+
"first": 0,
163+
"last": 9
164+
}
165+
],
166+
"brackets": 0,
167+
"strict": false,
168+
"errors": []
169+
},
170+
"errors": {
171+
"lexer": [],
172+
"parser": []
173+
}
174+
}

0 commit comments

Comments
 (0)