Ariel Weisberg created CASSANDRA-13186: ------------------------------------------
Summary: Create index fails if the primary key is included, but docs claim it is supported Key: CASSANDRA-13186 URL: https://issues.apache.org/jira/browse/CASSANDRA-13186 Project: Cassandra Issue Type: Bug Components: CQL Reporter: Ariel Weisberg {noformat} cqlsh:foo> CREATE TABLE users ( ... userid text PRIMARY KEY, ... first_name text, ... last_name text, ... emails set<text>, ... top_scores list<int>, ... todo map<timestamp, text> ... ); cqlsh:foo> create index bar on foo.users (userid, last_name); InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot create secondary index on partition key column userid" {noformat} {quote} <beobal> yes, it's a bug in CreateIndexStatement. The check to enforce the PK has only a single component is wrong it considers each target in isolation, so it doesn't take into account that you might be creating a custom index on a PK component + something else {quote} http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateIndex.html {quote} Cassandra supports creating an index on most columns, excluding counter columns but including a clustering column of a compound primary key or on the partition (primary) key itself. {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)