> > There is no way to mimic IF NOT EXISTS on UPDATE and it's not a bug. INSERT 
> > and UPDATE are not totally orthogonal
> in CQL and you should use INSERT for actual insertion and UPDATE for updates 
> (granted, the database will not reject
> our query if you break this rule but it's nonetheless the way it's intended 
> to be used).
> 
> OK.. (and not trying to be difficult here).  We can’t have it both ways. One 
> of these use cases is a bug…
> 
> You’re essentially saying “don’t do that, but yeah, you can do it.. “ 
> 
> Either UPDATE should support IF NOT EXISTS or UPDATE should not perform 
> INSERTs.
> 

UPDATE performs like INSERT in the meaning of an UPSERT - means: INSERT allows 
to write the same primary key again and UPDATE allows to write data to a 
non-existing primary key (effectively inserting data).
(That’s what NoSQL databases do.)
Take that as an advantage / feature not present on other DBs.

"UPDATE … IF EXISTS“ and "INSERT … IF NOT EXISTS“ are *expensive* operations 
(require serial-consistency/LWT which requires some more network roundtrips).
"IF [NOT] EXISTS“ is basically some kind of "convenience“.
And please take into account that UPDATE also has "IF column = value“ condition 
(using LWT).

Reply via email to