Skip to content

Commit 68db7f5

Browse files
authored
Copy table should not check feature flags for columns types (#17290)
1 parent e0dd26b commit 68db7f5

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,12 @@ class TCopyTable: public TSubOperation {
578578

579579
const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
580580
const TSchemeLimits& limits = domainInfo->GetSchemeLimits();
581+
// Copy table should not check feature flags for columns types.
582+
// If the types in original table are created then they should be allowed in destination table.
581583
const TTableInfo::TCreateAlterDataFeatureFlags featureFlags = {
582-
.EnableTablePgTypes = AppData()->FeatureFlags.GetEnableTablePgTypes(),
583-
.EnableTableDatetime64 = AppData()->FeatureFlags.GetEnableTableDatetime64(),
584-
.EnableParameterizedDecimal = AppData()->FeatureFlags.GetEnableParameterizedDecimal(),
584+
.EnableTablePgTypes = true,
585+
.EnableTableDatetime64 = true,
586+
.EnableParameterizedDecimal = true,
585587
};
586588
TTableInfo::TAlterDataPtr alterData = TTableInfo::CreateAlterData(nullptr, schema, *typeRegistry,
587589
limits, *domainInfo, featureFlags, errStr, LocalSequences);

ydb/core/tx/schemeshard/ut_base/ut_table_decimal_types.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,39 @@ Y_UNIT_TEST_SUITE(TSchemeShardDecimalTypesInTables) {
107107
});
108108
}
109109

110+
Y_UNIT_TEST(CopyTableShouldNotFailOnDisabledFeatureFlag) {
111+
TTestBasicRuntime runtime;
112+
TTestEnv env(runtime, TTestEnvOptions().EnableParameterizedDecimal(true));
113+
ui64 txId = 100;
114+
115+
AsyncCreateTable(runtime, ++txId, "/MyRoot", R"_(
116+
Name: "Table1"
117+
Columns { Name: "key" Type: "Decimal(35,6)" }
118+
Columns { Name: "value" Type: "Decimal(35,6)" }
119+
KeyColumnNames: ["key"]
120+
)_");
121+
TestModificationResults(runtime, txId, {TExpectedResult(NKikimrScheme::StatusAccepted)});
122+
env.TestWaitNotification(runtime, txId);
123+
124+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"), {
125+
NLs::PathExist,
126+
NLs::Finished,
127+
NLs::CheckColumnType(0, "Decimal(35,6)")
128+
});
129+
130+
runtime.GetAppData().FeatureFlags.SetEnableParameterizedDecimal(false);
131+
132+
AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy1", "/MyRoot/Table1");
133+
TestModificationResults(runtime, txId, {TExpectedResult(NKikimrScheme::StatusAccepted)});
134+
env.TestWaitNotification(runtime, txId);
135+
136+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"), {
137+
NLs::PathExist,
138+
NLs::Finished,
139+
NLs::CheckColumnType(0, "Decimal(35,6)")
140+
});
141+
}
142+
110143
Y_UNIT_TEST(CreateWithWrongParameters) {
111144
TTestBasicRuntime runtime;
112145
TTestEnv env(runtime, TTestEnvOptions().EnableParameterizedDecimal(true));

0 commit comments

Comments
 (0)