mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix
This commit is contained in:
parent
6ec59f1304
commit
38a9cba850
@ -18,6 +18,7 @@
|
||||
#include <ext/range.h>
|
||||
#include <common/logger_useful.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -26,7 +27,6 @@ namespace ErrorCodes
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
PostgreSQLBlockInputStream::PostgreSQLBlockInputStream(
|
||||
ConnectionPtr connection_,
|
||||
const std::string & query_str_,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <Core/Field.h>
|
||||
#include <pqxx/pqxx>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
using ConnectionPtr = std::shared_ptr<pqxx::connection>;
|
||||
|
@ -101,7 +101,12 @@ bool DatabasePostgreSQL::checkPostgresTable(const String & table_name) const
|
||||
|
||||
try
|
||||
{
|
||||
pqxx::result result = tx.exec(fmt::format("select '{}'::regclass", table_name));
|
||||
/// Casting table_name::regclass throws pqxx::indefined_table exception if table_name is incorrect.
|
||||
pqxx::result result = tx.exec(fmt::format(
|
||||
"SELECT '{}'::regclass, tablename "
|
||||
"FROM pg_catalog.pg_tables "
|
||||
"WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema' "
|
||||
"AND tablename = '{}'", table_name, table_name));
|
||||
}
|
||||
catch (pqxx::undefined_table const &)
|
||||
{
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <Parsers/ASTCreateQuery.h>
|
||||
#include <Storages/StoragePostgreSQL.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <pqxx/pqxx>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
@ -57,6 +58,11 @@ std::shared_ptr<NamesAndTypesList> fetchPostgreSQLTableStructure(ConnectionPtr c
|
||||
"PostgreSQL table {}.{} does not exist",
|
||||
connection->dbname(), postgres_table_name), ErrorCodes::UNKNOWN_TABLE);
|
||||
}
|
||||
catch (Exception & e)
|
||||
{
|
||||
e.addMessage("while fetching postgresql table structure");
|
||||
throw;
|
||||
}
|
||||
|
||||
if (columns.empty())
|
||||
return nullptr;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#if USE_LIBPQXX
|
||||
#include <Storages/StoragePostgreSQL.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "readInvalidateQuery.h"
|
||||
#endif
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <Storages/StoragePostgreSQL.h>
|
||||
#include <pqxx/pqxx>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -157,8 +157,10 @@ public:
|
||||
void writeSuffix() override
|
||||
{
|
||||
if (stream_inserter)
|
||||
{
|
||||
stream_inserter->complete();
|
||||
work->commit();
|
||||
work->commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <DataStreams/IBlockOutputStream.h>
|
||||
#include "pqxx/pqxx"
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "registerTableFunctions.h"
|
||||
#include <Databases/PostgreSQL/FetchFromPostgreSQL.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <Storages/StoragePostgreSQL.h>
|
||||
#include "pqxx/pqxx"
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user