Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7188210317 for ; Thu, 15 Aug 2013 16:40:32 +0000 (UTC) Received: (qmail 97244 invoked by uid 500); 15 Aug 2013 16:39:41 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 97230 invoked by uid 500); 15 Aug 2013 16:39:41 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 97200 invoked by uid 99); 15 Aug 2013 16:39:40 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2013 16:39:40 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CAF5A8372F8; Thu, 15 Aug 2013 16:39:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jbellis@apache.org To: commits@cassandra.apache.org Date: Thu, 15 Aug 2013 16:39:37 -0000 Message-Id: <8d372d7003c948caa4a94447321ea353@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: clarify error messages for zero/multiple PKs patch by Lyben Todorov; reviewed by jbellis for CASSANDRA-5875 Updated Branches: refs/heads/cassandra-2.0 c1cc50f69 -> e7c96c438 refs/heads/trunk 29605aedd -> 873ce0cb3 clarify error messages for zero/multiple PKs patch by Lyben Todorov; reviewed by jbellis for CASSANDRA-5875 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e7c96c43 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e7c96c43 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e7c96c43 Branch: refs/heads/cassandra-2.0 Commit: e7c96c438ca9d4ac43030306127a8698659ac033 Parents: c1cc50f Author: Jonathan Ellis Authored: Wed Aug 14 21:07:18 2013 -0500 Committer: Jonathan Ellis Committed: Wed Aug 14 21:07:27 2013 -0500 ---------------------------------------------------------------------- .../apache/cassandra/cql3/statements/CreateTableStatement.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e7c96c43/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java b/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java index 4037f40..a220366 100644 --- a/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/CreateTableStatement.java @@ -212,8 +212,10 @@ public class CreateTableStatement extends SchemaAlteringStatement stmt.columns.put(id, pt.getType()); // we'll remove what is not a column below } - if (keyAliases.size() != 1) - throw new InvalidRequestException("You must specify one and only one PRIMARY KEY"); + if (keyAliases.isEmpty()) + throw new InvalidRequestException("No PRIMARY KEY specifed (exactly one required)"); + else if (keyAliases.size() > 1) + throw new InvalidRequestException("Multiple PRIMARY KEYs specifed (exactly one required)"); List kAliases = keyAliases.get(0);