Merge branch 'master' of github.com:yandex/ClickHouse

This commit is contained in:
Alexey Milovidov 2017-07-10 21:28:11 +03:00
commit 2f866cf18f
4 changed files with 31 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# This strings autochanged from release_lib.sh:
set(VERSION_DESCRIBE v1.1.54249-testing)
set(VERSION_REVISION 54249)
set(VERSION_DESCRIBE v1.1.54250-testing)
set(VERSION_REVISION 54250)
# end of autochange
set (VERSION_MAJOR 1)

View File

@ -1,7 +1,7 @@
#include <Parsers/ASTSetQuery.h>
#include <Interpreters/Context.h>
#include <Interpreters/InterpreterSetQuery.h>
#include <Core/FieldVisitors.h>
namespace DB
{
@ -25,7 +25,6 @@ BlockIO InterpreterSetQuery::execute()
return {};
}
void InterpreterSetQuery::checkAccess(const ASTSetQuery & ast)
{
/** The `readonly` value is understood as follows:
@ -41,7 +40,7 @@ void InterpreterSetQuery::checkAccess(const ASTSetQuery & ast)
{
String value;
/// Setting isn't checked if value wasn't changed.
if (!settings.tryGet(change.name, value) || change.value != value)
if (!settings.tryGet(change.name, value) || applyVisitor(FieldVisitorToString(), change.value) != value)
{
if (readonly == 1)
throw Exception("Cannot execute SET query in readonly mode", ErrorCodes::READONLY);

View File

@ -0,0 +1,14 @@
"name": "value",
"value": 4611686018427387904
"name": "value",
"value": "4611686018427387904"
value
value
Cannot execute SET query in readonly mode.
"name": "value",
"value": "9223372036854775808"
"name": "value",
"value": 9223372036854775808
value
value
Cannot override setting

View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
clickhouse-client --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=0 | grep value
clickhouse-client --query="select toUInt64(pow(2, 62)) as value format JSON" --output_format_json_quote_64bit_integers=1 | grep value
clickhouse-client --user readonly --multiquery --query="set output_format_json_quote_64bit_integers=1 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.'
clickhouse-client --user readonly --multiquery --query="set output_format_json_quote_64bit_integers=0 ; select toUInt64(pow(2, 63)) as value format JSON" 2>&1 | grep -o 'value\|Cannot execute SET query in readonly mode.'
curl -sS 'http://localhost:8123/?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1' | grep value
curl -sS 'http://localhost:8123/?query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0' | grep value
curl -sS 'http://localhost:8123/?user=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=1' 2>&1 | grep -o 'value\|Cannot override setting'
curl -sS 'http://localhost:8123/?user=readonly&query=SELECT+toUInt64(pow(2,+63))+as+value+format+JSON&output_format_json_quote_64bit_integers=0' 2>&1 | grep -o 'value\|Cannot override setting'