You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2016/05/17 08:39:13 UTC

[jira] [Resolved] (CASSANDRA-11805) Row deleted when value updated to null

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

Sylvain Lebresne resolved CASSANDRA-11805.
------------------------------------------
    Resolution: Not A Problem

Yes, this is indeed the expected behavior, though that's arguably not terribly well documented. If you want to delete the row in a consistent way without knowing whether it was an {{INSERT}} or an {{UPDATE}}, you should do:
{noformat}
DELETE FROM aaa WHERE a='a' AND b='b';
{noformat}

> Row deleted when value updated to null
> --------------------------------------
>
>                 Key: CASSANDRA-11805
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11805
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: C* 3.5, both single node and cluster, C* 3.6 snapshot single node
>            Reporter: Jaroslav Kamenik
>
> It seems that the behaviour of the value update to null differs when row is created by insert or update. When it is inserted the row stays and the value is null, when updated the row is deleted.
> Simple example:
> Inserts:
> create table aaa (a ascii, b ascii, c ascii, primary key (a,b));
> insert into aaa (a,b,c) values ('a','b','c');
> insert into aaa (a,b,c) values ('a','c','d');
> insert into aaa (a,b,c) values ('a','d','e');
> select * from aaa;
>  a | b | c
> ---+---+---
>  a | b | c
>  a | c | d
>  a | d | e
> update aaa set c = null where a='a' and b='b';
> select * from aaa;
>  a | b | c
> ---+---+------
>  a | b | null
>  a | c |    d
>  a | d |    e
> Updates:
> create table bbb (a ascii, b ascii, c ascii, primary key (a,b));
> update bbb set c = 'c' where a='a' and b='b';
> update bbb set c = 'd' where a='a' and b='c';
> update bbb set c = 'e' where a='a' and b='d';
> select * from bbb;
>  a | b | c
> ---+---+---
>  a | b | c
>  a | c | d
>  a | d | e
> update bbb set c = null where a='a' and b='b';
> select * from bbb;
>  a | b | c
> ---+---+---
>  a | c | d
>  a | d | e



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)