Better err msg when condition is set on PK column

Patch by Tyler Hobbs; review by Sylvain Lebresne for CASSANDRA-7804


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e48e6f33
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e48e6f33
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e48e6f33

Branch: refs/heads/trunk
Commit: e48e6f33ab8f0f2259f3b7172698eb6b8bf74b23
Parents: 36ecc69
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Thu Aug 28 10:39:24 2014 -0500
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Thu Aug 28 10:39:24 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                        | 1 +
 .../apache/cassandra/cql3/statements/ModificationStatement.java    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/e48e6f33/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 20874ac..5b52471 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.11:
+ * Better error message when condition is set on PK column (CASSANDRA-7804)
  * Forbid re-adding dropped counter columns (CASSANDRA-7831)
  * Fix CFMetaData#isThriftCompatible() for PK-only tables (CASSANDRA-7832)
  * Always reject inequality on the partition key without token()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e48e6f33/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java 
b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
index 165dbc1..b214e76 100644
--- a/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/ModificationStatement.java
@@ -815,7 +815,7 @@ public abstract class ModificationStatement implements 
CQLStatement, MeasurableF
                         {
                             case KEY_ALIAS:
                             case COLUMN_ALIAS:
-                                throw new 
InvalidRequestException(String.format("PRIMARY KEY part %s found in SET part", 
entry.left));
+                                throw new 
InvalidRequestException(String.format("PRIMARY KEY column '%s' cannot have IF 
conditions", entry.left));
                             case VALUE_ALIAS:
                             case COLUMN_METADATA:
                             case STATIC:

Reply via email to