diff options
author | ilnaz <ilnaz@ydb.tech> | 2023-02-07 17:01:58 +0300 |
---|---|---|
committer | ilnaz <ilnaz@ydb.tech> | 2023-02-07 17:01:58 +0300 |
commit | 6ac0a7ffffa73823c1316966afbcfd7aa86cb6fb (patch) | |
tree | 7ad95f911719a30afa2dbdf4ca5343e8bc46eaed | |
parent | 94299c40d78c487307d3b744ecadf539dc13bb1a (diff) | |
download | ydb-6ac0a7ffffa73823c1316966afbcfd7aa86cb6fb.tar.gz |
Fix nullptr exception
-rw-r--r-- | ydb/core/kqp/provider/yql_kikimr_type_ann.cpp | 2 | ||||
-rw-r--r-- | ydb/core/kqp/ut/query/kqp_query_ut.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp index 8b9750b16a..a6706d8324 100644 --- a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp @@ -465,7 +465,7 @@ private: auto column = table->Metadata->Columns.FindPtr(TString(item->GetName())); if (!column) { ctx.AddError(YqlIssue(ctx.GetPosition(node.Pos()), TIssuesIds::KIKIMR_BAD_REQUEST, TStringBuilder() - << "Column '" << column->Name << "' does not exist in table '" << node.Table().Value() << "'.")); + << "Column '" << item->GetName() << "' does not exist in table '" << node.Table().Value() << "'.")); return TStatus::Error; } if (column->NotNull && item->HasOptionalOrNull()) { diff --git a/ydb/core/kqp/ut/query/kqp_query_ut.cpp b/ydb/core/kqp/ut/query/kqp_query_ut.cpp index 5d3b6ad4b9..e753b81d4e 100644 --- a/ydb/core/kqp/ut/query/kqp_query_ut.cpp +++ b/ydb/core/kqp/ut/query/kqp_query_ut.cpp @@ -1315,6 +1315,17 @@ Y_UNIT_TEST_SUITE(KqpQuery) { UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); } + Y_UNIT_TEST(TryToUpdateNonExistentColumn) { + TKikimrRunner kikimr; + auto db = kikimr.GetTableClient(); + auto session = db.CreateSession().GetValueSync().GetSession(); + + auto result = session.ExecuteDataQuery(Q1_(R"( + UPDATE `/Root/KeyValue` SET NonExistentColumn = 'NewValue' WHERE Key = 1; + )"), TTxControl::BeginTx().CommitTx()).ExtractValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString()); + } + } } // namespace NKqp |