incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Talbot <bryan.tal...@playnext.com>
Subject Re: Index with same Name but different keyspace
Date Mon, 19 May 2014 19:22:27 GMT
On Mon, May 19, 2014 at 6:39 AM, mahesh rajamani
<rajamani.mahesh@gmail.com>wrote:

> Sorry I just realized the table name in 2 schema are slightly different,
> but still i am not sure why i should not use same index name across
> different schema. Below is the instruction to reproduce.
>
>
> Created 2 keyspace using cassandra-cli
>
>
> [default@unknown] create keyspace keyspace1 with placement_strategy =
> 'org.apache.cassandra.locator.SimpleStrategy' and
> strategy_options={replication_factor:1};
>
> [default@unknown] create keyspace keyspace2 with placement_strategy =
> 'org.apache.cassandra.locator.SimpleStrategy' and
> strategy_options={replication_factor:1};
>
>
> Create table index using cqlsh as below:
>
>
> cqlsh> use keyspace1;
>
> cqlsh:keyspace1> CREATE TABLE table1 (version text, flag boolean, primary
> key (version));
>
> cqlsh:keyspace1> create index sversionindex on table1(flag);
>
> cqlsh:keyspace1> use keyspace2;
>
> cqlsh:keyspace2> CREATE TABLE table2 (version text, flag boolean, primary
> key (version));
>
> cqlsh:keyspace2> create index sversionindex on table2(flag);
>
> *Bad Request: Duplicate index name sversionindex*
>
>

Since index name is optional in the create index statement, you could just
omit it and let the system give it a unique name for you.

-Bryan

Mime
View raw message