2016-08-08 4 views
0

の更新値:カサンドラ:私は、この表を作成したクラスタリング列

CREATE TABLE postsbyuser(
    userid bigint, 
    posttime timestamp, 
    postid uuid, 
    postcontent text, 
    year bigint, 
    PRIMARY KEY ((userid,year), posttime) 
) WITH CLUSTERING ORDER BY (posttime DESC); 

私のクエリは、降順posttimeが注文した一年ですべてのユーザーの投稿を取得することです。順序付き がOKすべてですが、問題は、ユーザーがpostcontentを編集した場合posttimeが変更されるということです。

update postsbyuser set postcontent='edited content' and posttime=edit_time where userid=id and year=year 

私はエラーを取得:[Invalid query] message="PRIMARY KEY part time found in SET part"

はあなたの注文方法任意のアイデアを持っています時間の変化する投稿?

答えて

-1

クエリにクラスタリング列を指定する必要があります。

update postsbyuser set postcontent='edited content' and posttime=edit_time where userid=id and year=year and posttime=previous_post_time 
+0

プライマリキーに属するクラスタ化列の値を更新することはできません – pratsJ

関連する問題