What version of Cassandra are you using? I just tested this out against trunk and got reasonable behavior:
cqlsh:ks1> CREATE TABLE test (k int, s1 int static, s2 int static, c int, v int, PRIMARY KEY (k, c)); cqlsh:ks1> INSERT INTO test (k, c, v) VALUES (0, 0, 0); cqlsh:ks1> UPDATE test SET s1 = 0 WHERE k = 0 IF s1 = null; [applied] ----------- True cqlsh:ks1> TRUNCATE test; cqlsh:ks1> INSERT INTO test (k, c, v) VALUES (0, 0, 0); cqlsh:ks1> INSERT INTO test (k, s1) VALUES (0, 0) IF NOT EXISTS; [applied] ----------- True On Tue, Feb 23, 2016 at 6:15 PM, Nimi Wariboko Jr <n...@channelmeter.com> wrote: > I have a table with 2 static columns, and I write to either one of them, > if I then write to the other one using IF NOT EXISTS, it fails even though > it has never been written too before. Is it the case that all static > columns share the same "written too" marker? > > Given a table like so: > > CREATE TABLE test ( > id timeuuid, > foo int static, > bar int static, > baz int, > baq int > PRIMARY KEY (id, baz) > ) > > I'm seeing some confusing behavior see the statements below - > > """ > INSERT INTO cmpayments.report_payments (id, foo) VALUES (NOW(), 1) IF NOT > EXISTS; // succeeds > TRUNCATE test; > INSERT INTO cmpayments.report_payments (id, baq) VALUES > (99c30000-b01a-11e5-b170-0242ac110002, 1); > UPDATE cmpayments.report_payments SET foo = 1 WHERE > id=99c30000-b01a-11e5-b170-0242ac110002 IF foo=null; // fails, even though > foo=null > TRUNCATE test; > INSERT INTO cmpayments.report_payments (id, bar) VALUES > (99c30000-b01a-11e5-b170-0242ac110002, 1); // succeeds > INSERT INTO cmpayments.report_payments (id, foo) VALUES (NOW(), 1) IF NOT > EXISTS; // fails, even though foo=null, and has never been written too > """ > > Nimi > -- Tyler Hobbs DataStax <http://datastax.com/>