Skip to content

Commit 5ddda38

Browse files
committed
Document new table name length limit
CASSANDRA-20389 implemented limit on table name length of 222 characters. This commit updates the documentation to reflect this. It also adds an assert in CreateTableValidationTest to ensure that the documented limit matches the actual constant.
1 parent aa0e2f1 commit 5ddda38

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

doc/modules/cassandra/pages/cql/ddl.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ include::example$BNF/ks_table.bnf[]
2222
----
2323

2424
Both keyspace and table name should be comprised of only alphanumeric
25-
characters, cannot be empty and are limited in size to 48 characters
26-
(that limit exists mostly to avoid filenames (which may include the
25+
or underscore characters and cannot be empty.
26+
Keyspace name is limited in size to 48 characters, while
27+
table name is limited in size to 222 characters
28+
(those limits exist mostly to avoid filenames (which may include the
2729
keyspace and table name) to go over the limits of certain file systems).
2830
By default, keyspace and table names are case-insensitive (`myTable` is
2931
equivalent to `mytable`) but case sensitivity can be forced by using

test/unit/org/apache/cassandra/schema/CreateTableValidationTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.apache.cassandra.schema.SchemaConstants.TABLE_NAME_LENGTH;
4141
import static org.assertj.core.api.Assertions.assertThat;
4242
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
43+
import static org.junit.Assert.assertEquals;
4344
import static org.junit.Assert.assertTrue;
4445
import static org.junit.Assert.fail;
4546

@@ -170,6 +171,9 @@ public void testCreatingTableWithLongName() throws Throwable
170171
String tableName = StringUtils.repeat("t", FILENAME_LENGTH - tableIdSuffix);
171172
String tooLongTableName = StringUtils.repeat("l", FILENAME_LENGTH - tableIdSuffix + 1);
172173

174+
// Assert that the documented value of 222 corresponds to the actual constant.
175+
assertEquals(222, TABLE_NAME_LENGTH);
176+
173177
execute(String.format("CREATE KEYSPACE %s with replication = " +
174178
"{ 'class' : 'SimpleStrategy', 'replication_factor' : 1 }",
175179
keyspaceName));

0 commit comments

Comments
 (0)