Allow constraints for ODBC and JDBC tables

This commit is contained in:
Alexey Milovidov 2022-02-12 13:50:05 +03:00
parent 0ed56f0255
commit ccfc41bce5
3 changed files with 8 additions and 6 deletions

View File

@ -27,19 +27,19 @@ StorageXDBC::StorageXDBC(
const StorageID & table_id_,
const std::string & remote_database_name_,
const std::string & remote_table_name_,
const ColumnsDescription & columns_,
ColumnsDescription columns_,
ConstraintsDescription constraints_,
const String & comment,
ContextPtr context_,
const BridgeHelperPtr bridge_helper_)
/// Please add support for constraints as soon as StorageODBC or JDBC will support insertion.
: IStorageURLBase(
"",
context_,
table_id_,
IXDBCBridgeHelper::DEFAULT_FORMAT,
getFormatSettings(context_),
columns_,
ConstraintsDescription{},
std::move(columns_),
std::move(constraints_),
comment,
"" /* CompressionMethod */)
, bridge_helper(bridge_helper_)
@ -174,6 +174,7 @@ namespace
engine_args[1]->as<ASTLiteral &>().value.safeGet<String>(),
engine_args[2]->as<ASTLiteral &>().value.safeGet<String>(),
args.columns,
args.constraints,
args.comment,
args.getContext(),
bridge_helper);

View File

@ -32,7 +32,8 @@ public:
const StorageID & table_id_,
const std::string & remote_database_name,
const std::string & remote_table_name,
const ColumnsDescription & columns_,
ColumnsDescription columns_,
ConstraintsDescription constraints_,
const String & comment,
ContextPtr context_,
BridgeHelperPtr bridge_helper_);

View File

@ -97,7 +97,7 @@ StoragePtr ITableFunctionXDBC::executeImpl(const ASTPtr & /*ast_function*/, Cont
startBridgeIfNot(context);
auto columns = getActualTableStructure(context);
auto result = std::make_shared<StorageXDBC>(
StorageID(getDatabaseName(), table_name), schema_name, remote_table_name, columns, String{}, context, helper);
StorageID(getDatabaseName(), table_name), schema_name, remote_table_name, columns, ConstraintsDescription{}, String{}, context, helper);
result->startup();
return result;
}