diff --git a/.gitmodules b/.gitmodules index 954cea58a15..c7ff7cea7db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -214,7 +214,7 @@ url = https://github.com/jtv/libpqxx [submodule "contrib/libpq"] path = contrib/libpq - url = https://github.com/kssenii/libpq + url = https://github.com/ClickHouse-Extras/libpq [submodule "contrib/boringssl"] path = contrib/boringssl url = https://github.com/ClickHouse-Extras/boringssl.git diff --git a/src/DataStreams/PostgreSQLBlockInputStream.cpp b/src/DataStreams/PostgreSQLBlockInputStream.cpp index 774e3afcdb3..4d9a142da3d 100644 --- a/src/DataStreams/PostgreSQLBlockInputStream.cpp +++ b/src/DataStreams/PostgreSQLBlockInputStream.cpp @@ -231,23 +231,23 @@ void PostgreSQLBlockInputStream::prepareArrayInfo(size_t column_idx, const DataT Field default_value = nested->getDefault(); if (nested->isNullable()) - nested = typeid_cast(nested.get())->getNestedType(); + nested = static_cast(nested.get())->getNestedType(); WhichDataType which(nested); std::function parser; if (which.isUInt8() || which.isUInt16()) parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isUInt32()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; - else if (which.isUInt64()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; else if (which.isInt8() || which.isInt16()) parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isUInt32()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; else if (which.isInt32()) parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + else if (which.isUInt64()) + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; else if (which.isInt64()) - parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; + parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; else if (which.isFloat32()) parser = [](std::string & field) -> Field { return pqxx::from_string(field); }; else if (which.isFloat64()) @@ -279,6 +279,13 @@ void PostgreSQLBlockInputStream::prepareArrayInfo(size_t column_idx, const DataT DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); return convertFieldToType(field, res); }; + else if (which.isDecimal256()) + parser = [nested](std::string & field) -> Field + { + const auto & type = typeid_cast *>(nested.get()); + DataTypeDecimal res(getDecimalPrecision(*type), getDecimalScale(*type)); + return convertFieldToType(field, res); + }; else throw Exception(ErrorCodes::BAD_ARGUMENTS, "Type conversion to {} is not supported", nested->getName()); diff --git a/src/Storages/StoragePostgreSQL.cpp b/src/Storages/StoragePostgreSQL.cpp index c2aec72c66e..ea1279bc319 100644 --- a/src/Storages/StoragePostgreSQL.cpp +++ b/src/Storages/StoragePostgreSQL.cpp @@ -158,8 +158,7 @@ public: { if (stream_inserter) stream_inserter->complete(); - if (work) - work->commit(); + work->commit(); } @@ -201,7 +200,7 @@ public: /// Conversion is done via column casting because with writeText(Array..) got incorrect conversion /// of Date and DateTime data types and it added extra quotes for values inside array. - std::string clickhouseToPostgresArray(const Array & array_field, const DataTypePtr & data_type) + static std::string clickhouseToPostgresArray(const Array & array_field, const DataTypePtr & data_type) { auto nested = typeid_cast(data_type.get())->getNestedType(); ColumnPtr nested_column(createNested(nested)); @@ -221,7 +220,7 @@ public: if (nested->isNullable()) { is_nullable = true; - nested = typeid_cast(nested.get())->getNestedType(); + nested = static_cast(nested.get())->getNestedType(); } WhichDataType which(nested);