This commit is contained in:
kssenii 2022-06-23 21:52:57 +02:00
parent 40a4742f93
commit bc9b56096f

View File

@ -271,8 +271,24 @@ void MaterializedPostgreSQLConsumer::readTupleData(
} }
}; };
std::exception_ptr error;
for (int column_idx = 0; column_idx < num_columns; ++column_idx) for (int column_idx = 0; column_idx < num_columns; ++column_idx)
{
try
{
proccess_column_value(readInt8(message, pos, size), column_idx); proccess_column_value(readInt8(message, pos, size), column_idx);
}
catch (...)
{
insertDefaultValue(buffer, column_idx);
/// Let's collect only the first exception.
/// This delaying of error throw is needed because
/// some errors can be ignored and just logged,
/// but in this case we need to finish insertion to all columns.
if (!error)
error = std::current_exception();
}
}
switch (type) switch (type)
{ {
@ -303,6 +319,9 @@ void MaterializedPostgreSQLConsumer::readTupleData(
break; break;
} }
} }
if (error)
std::rethrow_exception(error);
} }