Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Correctness - Unrecoverable Corruption / Loss
-
Critical
-
Low Hanging Fruit
-
Code Inspection
-
All
-
None
-
Description
Create Type attempts to block undesired field types, but this validation is not cared over to Alter Type Add Field; which allows you to add unexpected/desired types
Assertions.assertThatThrownBy(() -> createType("CREATE TYPE %s (f counter)")).hasRootCauseMessage("A user type cannot contain counters"); String type = createType(KEYSPACE, "CREATE TYPE %s (a int)"); schemaChange(String.format("ALTER TYPE %s.%s ADD f counter", KEYSPACE, type)); UserType udt = Keyspace.open(KEYSPACE).getMetadata().types.get(UTF8Type.instance.decompose(type)).get(); logger.warn("UDT: {}", udt);
UDT: org.apache.cassandra.db.marshal.UserType(cql_test_keyspace,747970655f3031,61:org.apache.cassandra.db.marshal.Int32Type,66:org.apache.cassandra.db.marshal.CounterColumnType)