2019-08-29 12:36:06 +00:00
#!/usr/bin/env bash
CURDIR = $( cd " $( dirname " ${ BASH_SOURCE [0] } " ) " && pwd )
2020-08-01 00:51:12 +00:00
. " $CURDIR " /../shell_config.sh
2019-08-29 12:36:06 +00:00
2020-08-01 13:25:59 +00:00
CLICKHOUSE_CLIENT = $( echo ${ CLICKHOUSE_CLIENT } | sed 's/' " --send_logs_level= ${ CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL } " '/--send_logs_level=none/g' )
2019-08-29 17:30:16 +00:00
2019-08-29 12:36:06 +00:00
$CLICKHOUSE_CLIENT --query= "DROP TABLE IF EXISTS check;"
2020-01-18 01:52:01 +00:00
$CLICKHOUSE_CLIENT --query= "CREATE TABLE check (x UInt64, y UInt64 DEFAULT throwIf(x > 1500000)) ENGINE = Memory;"
2019-08-29 12:36:06 +00:00
2020-01-18 01:52:01 +00:00
seq 1 2000000 | $CLICKHOUSE_CLIENT --query= "INSERT INTO check(x) FORMAT TSV" 2>& 1 | grep -q "Value passed to 'throwIf' function is non zero." && echo 'OK' || echo 'FAIL' || :
2019-08-29 12:36:06 +00:00
$CLICKHOUSE_CLIENT --query= "DROP TABLE check;"