mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Merge remote-tracking branch 'origin/master' into fix-array-size-overflow-generate-random
This commit is contained in:
commit
306714f2d3
@ -103,6 +103,7 @@ namespace ErrorCodes
|
|||||||
extern const int CLIENT_OUTPUT_FORMAT_SPECIFIED;
|
extern const int CLIENT_OUTPUT_FORMAT_SPECIFIED;
|
||||||
extern const int INVALID_USAGE_OF_INPUT;
|
extern const int INVALID_USAGE_OF_INPUT;
|
||||||
extern const int DEADLOCK_AVOIDED;
|
extern const int DEADLOCK_AVOIDED;
|
||||||
|
extern const int UNRECOGNIZED_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1911,6 +1912,12 @@ public:
|
|||||||
|
|
||||||
/// Parse main commandline options.
|
/// Parse main commandline options.
|
||||||
po::parsed_options parsed = po::command_line_parser(common_arguments).options(main_description).run();
|
po::parsed_options parsed = po::command_line_parser(common_arguments).options(main_description).run();
|
||||||
|
auto unrecognized_options = po::collect_unrecognized(parsed.options, po::collect_unrecognized_mode::include_positional);
|
||||||
|
// unrecognized_options[0] is "", I don't understand why we need "" as the first argument which unused
|
||||||
|
if (unrecognized_options.size() > 1)
|
||||||
|
{
|
||||||
|
throw Exception("Unrecognized option '" + unrecognized_options[1] + "'", ErrorCodes::UNRECOGNIZED_ARGUMENTS);
|
||||||
|
}
|
||||||
po::variables_map options;
|
po::variables_map options;
|
||||||
po::store(parsed, options);
|
po::store(parsed, options);
|
||||||
po::notify(options);
|
po::notify(options);
|
||||||
@ -2069,6 +2076,12 @@ int mainEntryClickHouseClient(int argc, char ** argv)
|
|||||||
std::cerr << "Bad arguments: " << e.what() << std::endl;
|
std::cerr << "Bad arguments: " << e.what() << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
catch (const DB::Exception & e)
|
||||||
|
{
|
||||||
|
std::string text = e.displayText();
|
||||||
|
std::cerr << "Code: " << e.code() << ". " << text << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << DB::getCurrentExceptionMessage(true) << std::endl;
|
std::cerr << DB::getCurrentExceptionMessage(true) << std::endl;
|
||||||
|
@ -504,6 +504,7 @@ namespace ErrorCodes
|
|||||||
|
|
||||||
extern const int CONDITIONAL_TREE_PARENT_NOT_FOUND = 2001;
|
extern const int CONDITIONAL_TREE_PARENT_NOT_FOUND = 2001;
|
||||||
extern const int ILLEGAL_PROJECTION_MANIPULATOR = 2002;
|
extern const int ILLEGAL_PROJECTION_MANIPULATOR = 2002;
|
||||||
|
extern const int UNRECOGNIZED_ARGUMENTS = 2003;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
OK
|
OK
|
||||||
OK
|
OK
|
||||||
1
|
1
|
||||||
OK
|
FAIL
|
||||||
0
|
0
|
||||||
4
|
4
|
||||||
2
|
2
|
||||||
@ -9,8 +9,8 @@ OK
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
OK
|
OK
|
||||||
OK
|
OK
|
||||||
1
|
1
|
||||||
OK
|
FAIL
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
4
|
4
|
||||||
4
|
4
|
||||||
2
|
2
|
||||||
4
|
4
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
OK
|
FAIL
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
16
tests/queries/0_stateless/01339_client_unrecognized_option.sh
Executable file
16
tests/queries/0_stateless/01339_client_unrecognized_option.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
. $CURDIR/../shell_config.sh
|
||||||
|
|
||||||
|
$CLICKHOUSE_CLIENT xyzgarbage 2>&1 | grep -q "Code: 2003" && echo 'OK' || echo 'FAIL'
|
||||||
|
|
||||||
|
$CLICKHOUSE_CLIENT -xyzgarbage 2>&1 | grep -q "Bad arguments" && echo 'OK' || echo 'FAIL'
|
||||||
|
|
||||||
|
$CLICKHOUSE_CLIENT --xyzgarbage 2>&1 | grep -q "Bad arguments" && echo 'OK' || echo 'FAIL'
|
||||||
|
|
||||||
|
cat /etc/passwd | sed 's/:/\t/g' | $CLICKHOUSE_CLIENT --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' xyzgarbage 2>&1 | grep -q "Code: 2003" && echo 'OK' || echo 'FAIL'
|
||||||
|
|
||||||
|
cat /etc/passwd | sed 's/:/\t/g' | $CLICKHOUSE_CLIENT --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external -xyzgarbage --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' 2>&1 | grep -q "Bad arguments" && echo 'OK' || echo 'FAIL'
|
||||||
|
|
||||||
|
cat /etc/passwd | sed 's/:/\t/g' | $CLICKHOUSE_CLIENT --query="SELECT shell, count() AS c FROM passwd GROUP BY shell ORDER BY c DESC" --external --xyzgarbage --file=- --name=passwd --structure='login String, unused String, uid UInt16, gid UInt16, comment String, home String, shell String' 2>&1 | grep -q "Bad arguments" && echo 'OK' || echo 'FAIL'
|
Loading…
Reference in New Issue
Block a user