Skip to content

Commit d127968

Browse files
committed
add case
1 parent 155e8de commit d127968

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

ydb/core/kqp/ut/service/kqp_qs_queries_ut.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,8 +2164,22 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
21642164
auto result = db.ExecuteQuery(R"(
21652165
CREATE TABLE TestDdlDml1 (
21662166
Key Uint64,
2167-
Value1 String,
2168-
Value2 String,
2167+
PRIMARY KEY (Key)
2168+
);
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,
21692183
PRIMARY KEY (Key)
21702184
);
21712185
)", TTxControl::BeginTx().CommitTx()).ExtractValueSync();
@@ -2178,8 +2192,6 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
21782192
auto result = db.ExecuteQuery(R"(
21792193
CREATE TABLE TestDdlDml1 (
21802194
Key Uint64,
2181-
Value1 String,
2182-
Value2 String,
21832195
PRIMARY KEY (Key)
21842196
);
21852197
)", TTxControl::NoTx()).ExtractValueSync();
@@ -2192,8 +2204,6 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
21922204
SELECT * FROM TestDdlDml1;
21932205
CREATE TABLE TestDdlDml2 (
21942206
Key Uint64,
2195-
Value1 String,
2196-
Value2 String,
21972207
PRIMARY KEY (Key)
21982208
);
21992209
SELECT * FROM TestDdlDml2;

0 commit comments

Comments
 (0)