Skip to content

Commit 6c8c1fc

Browse files
committed
KIKIMR-18545: do not set not_null for default values
1 parent a833a43 commit 6c8c1fc

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

ydb/core/tx/schemeshard/ut_export/ut_export.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
365365
}
366366
}
367367
}
368-
not_null: false
369368
from_literal {
370369
type {
371370
optional_type {
@@ -390,7 +389,6 @@ columns {
390389
}
391390
}
392391
}
393-
not_null: false
394392
from_literal {
395393
type {
396394
optional_type {

ydb/core/ydb_convert/table_description.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,15 @@ static Ydb::Type* AddColumn(Ydb::Table::ColumnMeta* newColumn, const TColumn& co
370370
pg->set_oid(NPg::PgTypeIdFromTypeDesc(typeDesc));
371371
pg->set_typlen(0);
372372
pg->set_typmod(0);
373+
if (column.GetNotNull()) {
374+
newColumn->set_not_null(column.GetNotNull());
375+
}
373376
} else {
374377
NYql::NProto::TypeIds protoType;
375378
if (!NYql::NProto::TypeIds_Parse(column.GetType(), &protoType)) {
376379
throw NYql::TErrorException(NKikimrIssues::TIssuesIds::DEFAULT_ERROR)
377380
<< "Got invalid type: " << column.GetType() << " for column: " << column.GetName();
378381
}
379-
380382
if (column.GetNotNull()) {
381383
columnType = newColumn->mutable_type();
382384
} else {
@@ -392,7 +394,6 @@ static Ydb::Type* AddColumn(Ydb::Table::ColumnMeta* newColumn, const TColumn& co
392394
NMiniKQL::ExportPrimitiveTypeToProto(protoType, *columnType);
393395
}
394396
}
395-
newColumn->set_not_null(column.GetNotNull());
396397
return columnType;
397398
}
398399

@@ -410,13 +411,15 @@ Ydb::Type* AddColumn<NKikimrSchemeOp::TColumnDescription>(Ydb::Table::ColumnMeta
410411
pg->set_oid(NPg::PgTypeIdFromTypeDesc(typeDesc));
411412
pg->set_typlen(0);
412413
pg->set_typmod(0);
414+
if (column.GetNotNull()) {
415+
newColumn->set_not_null(column.GetNotNull());
416+
}
413417
} else {
414418
NYql::NProto::TypeIds protoType;
415419
if (!NYql::NProto::TypeIds_Parse(column.GetType(), &protoType)) {
416420
throw NYql::TErrorException(NKikimrIssues::TIssuesIds::DEFAULT_ERROR)
417421
<< "Got invalid type: " << column.GetType() << " for column: " << column.GetName();
418422
}
419-
420423
if (column.GetNotNull()) {
421424
columnType = newColumn->mutable_type();
422425
} else {
@@ -432,7 +435,6 @@ Ydb::Type* AddColumn<NKikimrSchemeOp::TColumnDescription>(Ydb::Table::ColumnMeta
432435
NMiniKQL::ExportPrimitiveTypeToProto(protoType, *columnType);
433436
}
434437
}
435-
newColumn->set_not_null(column.GetNotNull());
436438
switch (column.GetDefaultValueCase()) {
437439
case NKikimrSchemeOp::TColumnDescription::kDefaultFromLiteral: {
438440
auto fromLiteral = newColumn->mutable_from_literal();

ydb/services/ydb/ydb_ut.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,6 @@ columns {
12681268
}
12691269
}
12701270
}
1271-
not_null: false
12721271
}
12731272
columns {
12741273
name: "Value"
@@ -1279,7 +1278,6 @@ columns {
12791278
}
12801279
}
12811280
}
1282-
not_null: false
12831281
}
12841282
primary_key: "Key"
12851283
partitioning_settings {
@@ -1607,7 +1605,6 @@ columns {
16071605
}
16081606
}
16091607
}
1610-
not_null: false
16111608
}
16121609
columns {
16131610
name: "IValue"
@@ -1618,7 +1615,6 @@ columns {
16181615
}
16191616
}
16201617
}
1621-
not_null: false
16221618
}
16231619
primary_key: "Key"
16241620
indexes {

0 commit comments

Comments
 (0)