[
https://issues.apache.org/jira/browse/CASSANDRA-13186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418525#comment-17418525
]
Benjamin Lerer commented on CASSANDRA-13186:
--------------------------------------------
[~Gerrrr] It is a validation issue. You are hitting this
[check|https://github.com/apache/cassandra/blob/cassandra-3.11/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java#L130]
whereas I believe that you should hit this
[on|https://github.com/apache/cassandra/blob/cassandra-3.11/src/java/org/apache/cassandra/cql3/statements/CreateIndexStatement.java#L196].
> 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: Legacy/CQL
> Reporter: Ariel Weisberg
> Assignee: Aleksandr Sorokoumov
> Priority: Normal
>
> {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
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]