ClickHouse/tests/queries/0_stateless/02473_functions_in_readonly_mode.sh
SmitaRKulkarni 16fca48f5b
Disable functions in readonly for inserts (#44290)
Implementation:
* Added a new parameter to ITableFunction::execute to check if query is insert query.
* Used the new parameter in InterpreterInsertQuery::getTable function when calling ITableFunction::execute .
Testing:
* Added test case for INSERT in 02473_functions_in_readonly_mode.sh.

Co-authored-by: Nikita Mikhaylov <mikhaylovnikitka@gmail.com>
2023-01-03 15:25:04 +01:00

14 lines
732 B
Bash
Executable File

#!/usr/bin/env bash
unset CLICKHOUSE_LOG_COMMENT
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_CLIENT --query="SELECT * from numbers(1)"
$CLICKHOUSE_CLIENT --query="SELECT * from format('TSV', '123')"
$CLICKHOUSE_CLIENT --readonly=1 --query="SELECT * from numbers(1)"
$CLICKHOUSE_CLIENT --readonly=1 --query="SELECT * from format('TSV', '123')" 2>&1 | grep -Fq "Cannot execute query in readonly mode. (READONLY)" && echo 'ERROR' || echo 'OK'
$CLICKHOUSE_CLIENT --readonly=1 --query="INSERT INTO FUNCTION null('x String') (x) FORMAT TSV '123'" 2>&1 | grep -Fq "Cannot execute query in readonly mode. (READONLY)" && echo 'ERROR' || echo 'OK'