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

Deleting an element from a list in UPDATE does not work with IF condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Duplicate
    • None
    • None
    • None
    • Low

    Description

      When issuing a list deletion with an IF condition, that does not seem to work even when it says that the change was applied correctly.

      Here's a reproducible test case:

      cqlsh:casstest> create table foo(id text, values list<int>, condition int, primary key(id));
      cqlsh:casstest> insert into foo(id, values, condition)  values ('a', [1,2,3], 0);
      cqlsh:casstest> select * from foo;
      
       id | condition | values
      ----+-----------+-----------
        a |         0 | [1, 2, 3]
      
      (1 rows)
      
      cqlsh:casstest> update foo set values = values - [3] where id = 'a' IF condition = 0;
      
       [applied]
      -----------
            True
      
      cqlsh:casstest> select * from foo;
      
       id | condition | values
      ----+-----------+-----------
        a |         0 | [1, 2, 3]
      
      (1 rows)
      
      cqlsh:casstest> update foo set values = values - [3] where id = 'a';
      cqlsh:casstest> select * from foo;
      
       id | condition | values
      ----+-----------+--------
        a |         0 | [1, 2]
      
      (1 rows)
      
      

      Addition seems to work though

      cqlsh:casstest> update foo set values = values + [3] where id = 'a' IF condition = 0;
      
       [applied]
      -----------
            True
      
      cqlsh:casstest> select * from foo;
      
       id | condition | values
      ----+-----------+-----------
        a |         0 | [1, 2, 3]
      
      (1 rows)
      
      

      Attachments

        Issue Links

          Activity

            People

              slebresne Sylvain Lebresne
              anithrak Arvind Nithrakashyap
              Sylvain Lebresne
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: