Update 03167_improvement_table_name_too_long.sh

This commit is contained in:
Yarik Briukhovetskyi 2024-11-22 14:26:10 +01:00 committed by GitHub
parent f0b706ffde
commit 4c627aadd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,9 +4,8 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
max_name_length=$($CLICKHOUSE_CLIENT -mn --query="SELECT getMaxTableNameLengthForDatabase('$CLICKHOUSE_DATABASE')")
let allowed_name_length=max_name_length-5 # We substract 5 from the name length because when we create files in the test environment, they have the 'test_' prefix
let excess_length=allowed_name_length+1
allowed_name_length=$(( $($CLICKHOUSE_CLIENT -mn --query="SELECT getMaxTableNameLengthForDatabase('$CLICKHOUSE_DATABASE')") - 5 )) # Reserve 5 characters for 'test_' prefix
excess_length=$((allowed_name_length + 1)) # Ensure exceeding the limit
long_table_name=$(openssl rand -base64 $excess_length | tr -dc A-Za-z | head -c $excess_length)
allowed_table_name=$(openssl rand -base64 $allowed_name_length | tr -dc A-Za-z | head -c $allowed_name_length)