cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Paris (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-14505) Removal of last element on a List deletes the entire row
Date Thu, 07 Jun 2018 20:04:00 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-14505?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

André Paris updated CASSANDRA-14505:
------------------------------------
    Environment: 
* Java: 1.8.0_171
 * SO: Ubuntu 18.04 LTS
 * Cassandra: 3.11.2 

  was:
* Java: 1.8.0_171
 * SO Ubuntu: 18.04 LTS
 * Cassandra: 3.11.2 


> Removal of last element on a List deletes the entire row
> --------------------------------------------------------
>
>                 Key: CASSANDRA-14505
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14505
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: * Java: 1.8.0_171
>  * SO: Ubuntu 18.04 LTS
>  * Cassandra: 3.11.2 
>            Reporter: André Paris
>            Priority: Major
>             Fix For: 3.11.x
>
>
> The behavior of an element removal from a list by an UPDATE differs by how the row was
created:
> Given the table
> {{CREATE TABLE table_test (}}
> {{    id int PRIMARY KEY,}}
> {{    list list<text>}}
> {{)}}
> If the row is created by an INSERT, the row remains after the UPDATE to remove the last
element on the list:
> {{cqlsh:ks_test> INSERT INTO table_test (id, list ) VALUES ( 1, ['foo']) ;}}
> {{cqlsh:ks_test> SELECT * FROM table_test;}}
> {{ id | list}}
> {{----+---------}}
> {{  1 | ['foo'] }}
> {{(1 rows)}}
> {{cqlsh:ks_test> UPDATE table_test SET list = list - ['foo'] WHERE id=1;}}
> {{cqlsh:ks_test> SELECT * FROM table_test;}}
> {{ id | list}}
> {{----+------}}
> {{  1 | null}}
> {{(1 rows)}}
>  
> But, if the row is created by an UPDATE, the row is deleted after the UPDATE to remove
the last element on the list:
> {{cqlsh:ks_test> UPDATE table_test SET list = list + ['foo'] WHERE id=2;}}
> {{cqlsh:ks_test> SELECT * FROM table_test;}}
> {{ id | list}}
> {{----+---------}}
> {{  2 | ['foo'] }}
> {{(1 rows)}}
> {{cqlsh:ks_test> UPDATE table_test SET list = list - ['foo'] WHERE id=2;}}
> {{cqlsh:ks_test> SELECT * FROM table_test;}}
> {{ id | list}}
> {{----+------}}
> {{(0 rows)}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message