From 0d9c4388646959a262210164d20b30175412769d Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 22 Feb 2019 20:16:11 +0300 Subject: [PATCH] Added a test --- dbms/programs/odbc-bridge/MainHandler.cpp | 3 ++- dbms/src/IO/tests/CMakeLists.txt | 2 +- dbms/src/IO/tests/{operators.cpp => io_operators.cpp} | 6 ++++++ .../00898_parsing_bad_diagnostic_message.reference | 1 + .../0_stateless/00898_parsing_bad_diagnostic_message.sh | 8 ++++++++ 5 files changed, 18 insertions(+), 2 deletions(-) rename dbms/src/IO/tests/{operators.cpp => io_operators.cpp} (86%) create mode 100644 dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.reference create mode 100755 dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.sh diff --git a/dbms/programs/odbc-bridge/MainHandler.cpp b/dbms/programs/odbc-bridge/MainHandler.cpp index 2aebdda3b03..d95f1386c7b 100644 --- a/dbms/programs/odbc-bridge/MainHandler.cpp +++ b/dbms/programs/odbc-bridge/MainHandler.cpp @@ -37,7 +37,8 @@ ODBCHandler::PoolPtr ODBCHandler::getPool(const std::string & connection_str) std::lock_guard lock(mutex); if (!pool_map->count(connection_str)) { - pool_map->emplace(connection_str, createAndCheckResizePocoSessionPool([connection_str] { + pool_map->emplace(connection_str, createAndCheckResizePocoSessionPool([connection_str] + { return std::make_shared("ODBC", validateODBCConnectionString(connection_str)); })); } diff --git a/dbms/src/IO/tests/CMakeLists.txt b/dbms/src/IO/tests/CMakeLists.txt index 73497def442..29bb98c34ad 100644 --- a/dbms/src/IO/tests/CMakeLists.txt +++ b/dbms/src/IO/tests/CMakeLists.txt @@ -51,7 +51,7 @@ add_executable (hashing_read_buffer hashing_read_buffer.cpp) target_link_libraries (hashing_read_buffer PRIVATE clickhouse_common_io) add_check (hashing_read_buffer) -add_executable (io_operators operators.cpp) +add_executable (io_operators io_operators.cpp) target_link_libraries (io_operators PRIVATE clickhouse_common_io) if (OS_LINUX) diff --git a/dbms/src/IO/tests/operators.cpp b/dbms/src/IO/tests/io_operators.cpp similarity index 86% rename from dbms/src/IO/tests/operators.cpp rename to dbms/src/IO/tests/io_operators.cpp index 0944d17532e..3dd11b8f9d9 100644 --- a/dbms/src/IO/tests/operators.cpp +++ b/dbms/src/IO/tests/io_operators.cpp @@ -31,5 +31,11 @@ int main(int, char **) std::cerr << hello << '\n'; } + { + DB::WriteBufferFromFileDescriptor buf(STDOUT_FILENO); + size_t x = 11; + buf << "Column " << x << ", \n"; + } + return 0; } diff --git a/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.reference b/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.reference new file mode 100644 index 00000000000..3d5c2ac1055 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.reference @@ -0,0 +1 @@ +Column 11, name: c11, type: UInt8, ERROR: text "a" is not like UInt8 diff --git a/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.sh b/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.sh new file mode 100755 index 00000000000..6aa875cd2e2 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00898_parsing_bad_diagnostic_message.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# set -x + +CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CUR_DIR/../shell_config.sh + +echo -ne '0\t1\t2\t3\t4\t5\t6\t7\t8\t9\t10\ta' | $CLICKHOUSE_LOCAL --structure 'c0 UInt8, c1 UInt8, c2 UInt8, c3 UInt8, c4 UInt8, c5 UInt8, c6 UInt8, c7 UInt8, c8 UInt8, c9 UInt8, c10 UInt8, c11 UInt8' --input-format TSV --query 'SELECT * FROM table' 2>&1 | grep -F 'Column 11'