Fix build, update libpq

This commit is contained in:
kssenii 2020-12-28 19:16:10 +00:00
parent c5cf556aaf
commit fa3297bf72
4 changed files with 10 additions and 10 deletions

2
contrib/libpq vendored

@ -1 +1 @@
Subproject commit e2154c4752515623e52f437e2c95138b2c54b5d1
Subproject commit e8728ef514677e1a974b63950d789c3ed30c4fe5

View File

@ -23,11 +23,14 @@
# include <Databases/MySQL/DatabaseConnectionMySQL.h>
# include <Databases/MySQL/MaterializeMySQLSettings.h>
# include <Databases/MySQL/DatabaseMaterializeMySQL.h>
# include <Interpreters/evaluateConstantExpression.h>
# include <Common/parseAddress.h>
# include <mysqlxx/Pool.h>
#endif
#if USE_MYSQL || USE_LIBPQXX
#include <Interpreters/evaluateConstantExpression.h>
#include <Common/parseAddress.h>
#endif
#if USE_LIBPQXX
#include <Databases/PostgreSQL/DatabasePostgreSQL.h>
#endif

View File

@ -72,7 +72,7 @@ DatabaseTablesIteratorPtr DatabasePostgreSQL::getTablesIterator(
Tables tables;
auto table_names = fetchTablesList();
for (auto & table_name : table_names)
for (const auto & table_name : table_names)
if (!detached_or_dropped.count(table_name))
tables[table_name] = fetchTable(table_name, context, true);
@ -102,10 +102,7 @@ bool DatabasePostgreSQL::checkPostgresTable(const String & table_name) const
"SELECT tablename FROM pg_catalog.pg_tables "
"WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema' AND tablename = '{}'", table_name));
if (result.empty())
return false;
return true;
return !result.empty();
}

View File

@ -92,8 +92,8 @@ DataTypePtr getDataType(std::string & type, bool is_nullable, uint16_t dimension
if (result.size() < 3)
throw Exception("Numeric lacks precision and scale in its definition", ErrorCodes::UNKNOWN_TYPE);
uint32_t precision = std::atoi(result[1].data());
uint32_t scale = std::atoi(result[2].data());
uint32_t precision = pqxx::from_string<uint32_t>(result[1]);
uint32_t scale = pqxx::from_string<uint32_t>(result[2]);
if (precision <= DecimalUtils::maxPrecision<Decimal32>())
res = std::make_shared<DataTypeDecimal<Decimal32>>(precision, scale);