Question

According to the docs: http://cassandra.apache.org/doc/cql3/CQL.html#dropTableStmt and http://www.datastax.com/documentation/cql/3.1/webhelp/index.html#cql/cql_reference/drop_table_r.html

It is possible to drop a table only if it exists by using the syntax:

DROP TABLE IF EXISTS keyspace_name.table_name

However I get the following error:

cqlsh:default> DROP TABLE IF EXISTS default.my_table;
Bad Request: line 1:14 no viable alternative at input 'EXISTS'

I'm using the following versions: [cqlsh 4.1.0 | Cassandra 1.2.10 | CQL spec 3.0.5 | Thrift protocol 19.36.0]

Am I missing something or is this a documentation issue?

Was it helpful?

Solution

This functionality is for cassandra 2.x and later. Check this blog out, it describes the improvements for cql3 in C* 2.0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top