mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #53832 from kssenii/mat-pg-fix-get-create-table
Materialized postgres: fix uncaught exception in getCreateTableQueryImpl
This commit is contained in:
commit
8633b8fbc9
@ -35,6 +35,7 @@ namespace ErrorCodes
|
||||
extern const int UNKNOWN_TABLE;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
extern const int NOT_IMPLEMENTED;
|
||||
extern const int CANNOT_GET_CREATE_TABLE_QUERY;
|
||||
}
|
||||
|
||||
DatabaseMaterializedPostgreSQL::DatabaseMaterializedPostgreSQL(
|
||||
@ -221,10 +222,25 @@ ASTPtr DatabaseMaterializedPostgreSQL::getCreateTableQueryImpl(const String & ta
|
||||
|
||||
std::lock_guard lock(handler_mutex);
|
||||
|
||||
/// FIXME TSA
|
||||
ASTPtr ast_storage;
|
||||
try
|
||||
{
|
||||
auto storage = std::make_shared<StorageMaterializedPostgreSQL>(StorageID(TSA_SUPPRESS_WARNING_FOR_READ(database_name), table_name), getContext(), remote_database_name, table_name);
|
||||
auto ast_storage = replication_handler->getCreateNestedTableQuery(storage.get(), table_name);
|
||||
ast_storage = replication_handler->getCreateNestedTableQuery(storage.get(), table_name);
|
||||
assert_cast<ASTCreateQuery *>(ast_storage.get())->uuid = UUIDHelpers::generateV4();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (throw_on_error)
|
||||
{
|
||||
throw Exception(ErrorCodes::CANNOT_GET_CREATE_TABLE_QUERY,
|
||||
"Received error while fetching table structure for table {} from PostgreSQL: {}",
|
||||
backQuote(table_name), getCurrentExceptionMessage(true));
|
||||
}
|
||||
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
return ast_storage;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user