diff --git a/ydb/library/yql/sql/v1/SQLv1.g.in b/ydb/library/yql/sql/v1/SQLv1.g.in index f9fd24ef8a9d..46f907409530 100644 --- a/ydb/library/yql/sql/v1/SQLv1.g.in +++ b/ydb/library/yql/sql/v1/SQLv1.g.in @@ -653,11 +653,12 @@ create_table_entry: | an_id_schema ; -create_backup_collection_stmt: CREATE backup_collection WITH LPAREN backup_collection_settings RPAREN database_or_table_list?; +create_backup_collection_stmt: CREATE backup_collection create_backup_collection_entries? WITH LPAREN backup_collection_settings RPAREN; alter_backup_collection_stmt: ALTER backup_collection (alter_backup_collection_actions | alter_backup_collection_entries); drop_backup_collection_stmt: DROP backup_collection; -database_or_table_list: DATABASE | table_list; +create_backup_collection_entries: DATABASE | create_backup_collection_entries_many; +create_backup_collection_entries_many: LPAREN table_list RPAREN; table_list: TABLE an_id_table (COMMA TABLE an_id_table)*; alter_backup_collection_actions: alter_backup_collection_action (COMMA alter_backup_collection_action)*; diff --git a/ydb/library/yql/sql/v1/SQLv1Antlr4.g.in b/ydb/library/yql/sql/v1/SQLv1Antlr4.g.in index 912ec5e4391b..3758c6f69c17 100644 --- a/ydb/library/yql/sql/v1/SQLv1Antlr4.g.in +++ b/ydb/library/yql/sql/v1/SQLv1Antlr4.g.in @@ -652,11 +652,12 @@ create_table_entry: | an_id_schema ; -create_backup_collection_stmt: CREATE backup_collection WITH LPAREN backup_collection_settings RPAREN database_or_table_list?; +create_backup_collection_stmt: CREATE backup_collection create_backup_collection_entries? WITH LPAREN backup_collection_settings RPAREN; alter_backup_collection_stmt: ALTER backup_collection (alter_backup_collection_actions | alter_backup_collection_entries); drop_backup_collection_stmt: DROP backup_collection; -database_or_table_list: DATABASE | table_list; +create_backup_collection_entries: DATABASE | create_backup_collection_entries_many; +create_backup_collection_entries_many: LPAREN table_list RPAREN; table_list: TABLE an_id_table (COMMA TABLE an_id_table)*; alter_backup_collection_actions: alter_backup_collection_action (COMMA alter_backup_collection_action)*; diff --git a/ydb/library/yql/sql/v1/format/sql_format_ut.h b/ydb/library/yql/sql/v1/format/sql_format_ut.h index 609fdd1a95ae..951bf4279898 100644 --- a/ydb/library/yql/sql/v1/format/sql_format_ut.h +++ b/ydb/library/yql/sql/v1/format/sql_format_ut.h @@ -1579,10 +1579,10 @@ Y_UNIT_TEST(BackupCollectionOperations) { TCases cases = { {"creAte BackuP colLection `-naMe` wIth (a = \"b\")", "CREATE BACKUP COLLECTION `-naMe` WITH (a = \"b\");\n"}, - {"creAte BackuP colLection `-naMe` wIth (a = \"b\") DATabase", - "CREATE BACKUP COLLECTION `-naMe` WITH (a = \"b\") DATABASE;\n"}, - {"creAte BackuP colLection `-naMe` wIth (a = \"b\") tabLe `tbl1` , TablE `tbl2`", - "CREATE BACKUP COLLECTION `-naMe` WITH (a = \"b\") TABLE `tbl1`, TABLE `tbl2`;\n"}, + {"creAte BackuP colLection `-naMe` DATabase wIth (a = \"b\")", + "CREATE BACKUP COLLECTION `-naMe` DATABASE WITH (a = \"b\");\n"}, + {"creAte BackuP colLection `-naMe` ( tabLe `tbl1` , TablE `tbl2`) wIth (a = \"b\")", + "CREATE BACKUP COLLECTION `-naMe` (TABLE `tbl1`, TABLE `tbl2`) WITH (a = \"b\");\n"}, {"alTer bACKuP coLLECTION naMe resEt (b, c), seT (x=y, z=false)", "ALTER BACKUP COLLECTION naMe\n\tRESET (b, c),\n\tSET (x = y, z = FALSE);\n"}, {"alTer bACKuP coLLECTION naMe aDD DATAbase", diff --git a/ydb/library/yql/sql/v1/sql_query.cpp b/ydb/library/yql/sql/v1/sql_query.cpp index 664458a7ba55..36a348867315 100644 --- a/ydb/library/yql/sql/v1/sql_query.cpp +++ b/ydb/library/yql/sql/v1/sql_query.cpp @@ -1388,16 +1388,24 @@ bool TSqlQuery::Statement(TVector& blocks, const TRule_sql_stmt_core& } std::map kv; - if (!ParseBackupCollectionSettings(kv, node.GetRule_backup_collection_settings5())) { + if (!ParseBackupCollectionSettings(kv, node.GetRule_backup_collection_settings6())) { return false; } bool database = false; TVector tables; - if (node.HasBlock7()) { - database = node.GetBlock7().GetRule_database_or_table_list1().has_alt_database_or_table_list1(); - if (node.GetBlock7().GetRule_database_or_table_list1().has_alt_database_or_table_list2()) { - if (!ParseBackupCollectionTables(tables, node.GetBlock7().GetRule_database_or_table_list1().alt_database_or_table_list2().rule_table_list1())) { + if (node.HasBlock3()) { + database = node.GetBlock3().GetRule_create_backup_collection_entries1().has_alt_create_backup_collection_entries1(); + if (node.GetBlock3().GetRule_create_backup_collection_entries1().has_alt_create_backup_collection_entries2()) { + if (!ParseBackupCollectionTables( + tables, + node + .GetBlock3() + .GetRule_create_backup_collection_entries1() + .alt_create_backup_collection_entries2() + .GetRule_create_backup_collection_entries_many1() + .GetRule_table_list2())) + { return false; } }