@@ -2146,7 +2146,7 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
21462146 }
21472147 }
21482148
2149- Y_UNIT_TEST (Ddl_Dml ) {
2149+ Y_UNIT_TEST (DdlWithExplicitTransaction ) {
21502150 NKikimrConfig::TAppConfig appConfig;
21512151 appConfig.MutableTableServiceConfig ()->SetEnablePreparedDdl (true );
21522152 appConfig.MutableTableServiceConfig ()->SetEnableAstCache (true );
@@ -2160,23 +2160,71 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
21602160 auto db = kikimr.GetQueryClient ();
21612161
21622162 {
2163- // DDl + DML with explicit transaction
2163+ // DDl with explicit transaction
21642164 auto result = db.ExecuteQuery (R"(
21652165 CREATE TABLE TestDdlDml1 (
21662166 Key Uint64,
2167- Value1 String,
2168- Value2 String,
21692167 PRIMARY KEY (Key)
21702168 );
2171- UPSERT INTO TestDdlDml1 (Key, Value1, Value2) VALUES (1, "1", "2");
2172- SELECT * FROM TestDdlDml1;
2173- ALTER TABLE TestDdlDml1 DROP COLUMN Value2;
2174- UPSERT INTO TestDdlDml1 (Key, Value1) VALUES (2, "2");
2169+ )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
2170+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::PRECONDITION_FAILED, result.GetIssues ().ToString ());
2171+ UNIT_ASSERT (result.GetIssues ().ToOneLineString ().Contains (" Scheme operations cannot be executed inside transaction" ));
2172+ }
2173+
2174+ {
2175+ // DDl with explicit transaction
2176+ auto result = db.ExecuteQuery (R"(
2177+ CREATE TABLE TestDdlDml1 (
2178+ Key Uint64,
2179+ PRIMARY KEY (Key)
2180+ );
2181+ CREATE TABLE TestDdlDml2 (
2182+ Key Uint64,
2183+ PRIMARY KEY (Key)
2184+ );
2185+ )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
2186+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::PRECONDITION_FAILED, result.GetIssues ().ToString ());
2187+ UNIT_ASSERT (result.GetIssues ().ToOneLineString ().Contains (" Scheme operations cannot be executed inside transaction" ));
2188+ }
2189+
2190+ {
2191+ // DDl with implicit transaction
2192+ auto result = db.ExecuteQuery (R"(
2193+ CREATE TABLE TestDdlDml1 (
2194+ Key Uint64,
2195+ PRIMARY KEY (Key)
2196+ );
2197+ )" , TTxControl::NoTx ()).ExtractValueSync ();
2198+ UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::SUCCESS, result.GetIssues ().ToString ());
2199+ }
2200+
2201+ {
2202+ // DDl + DML with explicit transaction
2203+ auto result = db.ExecuteQuery (R"(
21752204 SELECT * FROM TestDdlDml1;
2205+ CREATE TABLE TestDdlDml2 (
2206+ Key Uint64,
2207+ PRIMARY KEY (Key)
2208+ );
2209+ SELECT * FROM TestDdlDml2;
21762210 )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
21772211 UNIT_ASSERT_VALUES_EQUAL_C (result.GetStatus (), EStatus::GENERIC_ERROR, result.GetIssues ().ToString ());
21782212 UNIT_ASSERT (result.GetIssues ().ToOneLineString ().Contains (" Queries with mixed data and scheme operations are not supported." ));
21792213 }
2214+ }
2215+
2216+ Y_UNIT_TEST (Ddl_Dml) {
2217+ NKikimrConfig::TAppConfig appConfig;
2218+ appConfig.MutableTableServiceConfig ()->SetEnablePreparedDdl (true );
2219+ appConfig.MutableTableServiceConfig ()->SetEnableAstCache (true );
2220+ appConfig.MutableTableServiceConfig ()->SetEnablePerStatementQueryExecution (true );
2221+ auto setting = NKikimrKqp::TKqpSetting ();
2222+ auto serverSettings = TKikimrSettings ()
2223+ .SetAppConfig (appConfig)
2224+ .SetKqpSettings ({setting});
2225+
2226+ TKikimrRunner kikimr (serverSettings);
2227+ auto db = kikimr.GetQueryClient ();
21802228
21812229 {
21822230 // DDl + DML with implicit transaction
0 commit comments