diff --git a/tests/Parser/AlterStatementTest.php b/tests/Parser/AlterStatementTest.php index 4a715522a..a6f0b97e3 100644 --- a/tests/Parser/AlterStatementTest.php +++ b/tests/Parser/AlterStatementTest.php @@ -43,6 +43,7 @@ public function alterProvider(): array ['parser/parseAlterTableRenameIndex'], ['parser/parseAlterTablePartitionByRange1'], ['parser/parseAlterTablePartitionByRange2'], + ['parser/parseAlterTableCoalescePartition'], ['parser/parseAlterWithInvisible'], ['parser/parseAlterTableCharacterSet1'], ['parser/parseAlterTableCharacterSet2'], diff --git a/tests/data/parser/parseAlterTableCoalescePartition.in b/tests/data/parser/parseAlterTableCoalescePartition.in new file mode 100644 index 000000000..c39bf637e --- /dev/null +++ b/tests/data/parser/parseAlterTableCoalescePartition.in @@ -0,0 +1 @@ +ALTER TABLE `MY_TABLE` COALESCE PARTITION 2; \ No newline at end of file diff --git a/tests/data/parser/parseAlterTableCoalescePartition.out b/tests/data/parser/parseAlterTableCoalescePartition.out new file mode 100644 index 000000000..36652a2d5 --- /dev/null +++ b/tests/data/parser/parseAlterTableCoalescePartition.out @@ -0,0 +1,174 @@ +{ + "query": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;", + "lexer": { + "@type": "PhpMyAdmin\\SqlParser\\Lexer", + "str": "ALTER TABLE `MY_TABLE` COALESCE PARTITION 2;", + "len": 44, + "last": 44, + "list": { + "@type": "PhpMyAdmin\\SqlParser\\TokensList", + "tokens": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "ALTER", + "value": "ALTER", + "keyword": "ALTER", + "type": 1, + "flags": 3, + "position": 0 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 5 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "TABLE", + "value": "TABLE", + "keyword": "TABLE", + "type": 1, + "flags": 3, + "position": 6 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 11 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "`MY_TABLE`", + "value": "MY_TABLE", + "keyword": null, + "type": 8, + "flags": 2, + "position": 12 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 22 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "COALESCE PARTITION", + "value": "COALESCE PARTITION", + "keyword": "COALESCE PARTITION", + "type": 1, + "flags": 7, + "position": 23 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": " ", + "value": " ", + "keyword": null, + "type": 3, + "flags": 0, + "position": 41 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": "2", + "value": 2, + "keyword": null, + "type": 6, + "flags": 0, + "position": 42 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": ";", + "value": ";", + "keyword": null, + "type": 9, + "flags": 0, + "position": 43 + }, + { + "@type": "PhpMyAdmin\\SqlParser\\Token", + "token": null, + "value": null, + "keyword": null, + "type": 9, + "flags": 0, + "position": null + } + ], + "count": 11, + "idx": 11 + }, + "delimiter": ";", + "delimiterLen": 1, + "strict": false, + "errors": [] + }, + "parser": { + "@type": "PhpMyAdmin\\SqlParser\\Parser", + "list": { + "@type": "@1" + }, + "statements": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Statements\\AlterStatement", + "table": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\Expression", + "database": null, + "table": "MY_TABLE", + "column": null, + "expr": "`MY_TABLE`", + "alias": null, + "function": null, + "subquery": null + }, + "altered": [ + { + "@type": "PhpMyAdmin\\SqlParser\\Components\\AlterOperation", + "options": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", + "options": { + "1": { + "name": "COALESCE PARTITION", + "equals": false, + "expr": "2", + "value": "2" + } + } + }, + "field": null, + "partitions": null, + "unknown": [] + } + ], + "options": { + "@type": "PhpMyAdmin\\SqlParser\\Components\\OptionsArray", + "options": { + "3": "TABLE" + } + }, + "first": 0, + "last": 9 + } + ], + "brackets": 0, + "strict": false, + "errors": [] + }, + "errors": { + "lexer": [], + "parser": [] + } +} \ No newline at end of file