Skip to content

Commit

Permalink
Merge pull request ClickHouse#72566 from ClickHouse/fix_03167_improve…
Browse files Browse the repository at this point in the history
…ment_table_name_too_long

Fix 03167_improvement_table_name_too_long
  • Loading branch information
nickitat authored Nov 28, 2024
2 parents bc79653 + dde239d commit f00b0b0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
allowed_name_length=$($CLICKHOUSE_CLIENT -mn --query="SELECT getMaxTableNameLengthForDatabase('$CLICKHOUSE_DATABASE')")
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)
long_table_name=$(openssl rand -base64 $((3 * excess_length)) | tr -dc A-Za-z | head -c $excess_length)
allowed_table_name=$(openssl rand -base64 $((3 * allowed_name_length)) | tr -dc A-Za-z | head -c $allowed_name_length)

$CLICKHOUSE_CLIENT -mn --query="CREATE TABLE $long_table_name (id UInt32, long_table_name String) Engine=MergeTree() order by id;" 2>&1 | grep -o -m 1 'ARGUMENT_OUT_OF_BOUND'
$CLICKHOUSE_CLIENT -mn --query="CREATE TABLE $allowed_table_name (id UInt32, allowed_table_name String) Engine=MergeTree() order by id;"
Expand Down

0 comments on commit f00b0b0

Please sign in to comment.