From f18f724f1c39e63ffd2e28044f33276bfdd12cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Tue, 11 Jul 2017 12:10:15 +0300 Subject: [PATCH] Generate an error when CONTAINS is used on a non-collection column MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2255 Signed-off-by: Botond Dénes Message-Id: <517bb6268ac213aed9a1def231614c2e88f77c9f.1499764183.git.bdenes@scylladb.com> --- cql3/single_column_relation.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cql3/single_column_relation.cc b/cql3/single_column_relation.cc index 6628a8dcad..80a90d1dc2 100644 --- a/cql3/single_column_relation.cc +++ b/cql3/single_column_relation.cc @@ -130,6 +130,10 @@ single_column_relation::to_receivers(schema_ptr schema, const column_definition& } } + if (is_contains() && !receiver->type->is_collection()) { + throw exceptions::invalid_request_exception(sprint("Cannot use CONTAINS on non-collection column \"%s\"", receiver->name)); + } + if (is_contains_key()) { if (!dynamic_cast(receiver->type.get())) { throw exceptions::invalid_request_exception(sprint("Cannot use CONTAINS KEY on non-map column %s", receiver->name));