Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-11331

Create Index IF NOT EXISTS throws error when index already exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.0.5, 3.5
    • Legacy/CQL
    • None
    • Normal

    Description

      While testing with trunk, I see that issuing the following queries throws an InvalidRequest, despite being valid.

      CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
      USE k;
      CREATE TABLE k.t (
          id int PRIMARY KEY,
          v int,
          v2 int,
          v3 text
      );
      CREATE INDEX IF NOT EXISTS ON t (v2);
      CREATE INDEX IF NOT EXISTS ON t (v2);
      InvalidRequest: code=2200 [Invalid query] message="Index t_v2_idx_1 is a duplicate of existing index t_v2_idx"
      

      The second CREATE INDEX IF NOT EXISTS should work fine.

      Attachments

        Activity

          People

            samt Sam Tunnicliffe
            philipthompson Philip Thompson
            Sam Tunnicliffe
            Benjamin Lerer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: