Reputation: 253
I have a record in cassandra table containing null value and want to update it to a new value
cqlsh:mydb> select * from mytable where id = 21;
id | value
---------+-------
21 | null
cqlsh:mydb> select WRITETIME(value) AS timestamp_value from mytable where id = 21;
timestamp_value
-----------------
null
But Insert
or Update
statements have no effect.
UPDATE mytable USING TIMESTAMP 3392962145717000 SET value = "new value" WHERE id=21;
INSERT INTO mytable (id,value) VALUES (21,"new value") USING TIMESTAMP 3392962145717000;
After executing the timestamp and value remain unchanged and no error is reported. Is there a way to update the row with a new value?
Upvotes: 0
Views: 103
Reputation: 76
What Cassandra version are you using?
I did the test in Astra and it works
token@cqlsh:catalog> CREATE TABLE catalog.mytable (
... id int,
... value text,
... PRIMARY KEY (id)
... );
token@cqlsh:catalog> INSERT INTO catalog.mytable (id) VALUES (21);
token@cqlsh:catalog> select WRITETIME(value) AS timestamp_value from catalog.mytable where id = 21;
timestamp_value
-----------------
null
(1 rows)
token@cqlsh:catalog> UPDATE mytable USING TIMESTAMP 3392962145717000 SET value = 'new value' WHERE id=21;
token@cqlsh:catalog> select * from mytable where id=21;
id | value
----+-----------
21 | new value
Upvotes: 0