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

Incorrect result on conditional UPDATE with static and regular conditions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Invalid
    • None
    • CQL/Semantics
    • None
    • All
    • None

    Description

      The below example conditional update is wrongly evaluated to True and applied even though clustering key 'k1' is not present in the table:

      CREATE KEYSPACE test_keyspace WITH replication = \{'class': 'SimpleStrategy', 'replication_factor': 1};
      CREATE TABLE test_table (id int, k text, version int static, v text, PRIMARY KEY (id, k));
      INSERT INTO test_table(id, version) VALUES (0, 0);
      SELECT * FROM test_table;
      
      id | k | version | v
      ----+------+---------+------
       0 | null | 0 | null
      
      (1 rows)
      SELECT * FROM test_table WHERE id=0 AND k='k1';
      
      id | k | version | v
      ----+---+---------+---
      
      (0 rows)
      UPDATE test_table SET v='foo', version=1 WHERE id=0 AND k='k1' IF version = 0;
      
      [applied]
      -----------
       True
      
      SELECT * FROM test_table;
      
      id | k | version | v
      ----+----+---------+-----
       0 | k1 | 1 | foo
      
      (1 rows)
      DROP TABLE test_table;
      DROP KEYSPACE test_keyspace;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Osipov Konstantin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: