I am working on Cassandra migration. I built a new Cassandra cluster - Cassandra 2.1.8 on Ubuntu 14.04. Database was restored from snapshots. Source Cassandra cluster is also version 2.1.8.
I am facing with this weird issue.
On the original cluster I can run following query using cqlsh without any errors. cqlsh is version 5.0.1.
SELECT * FROM "featureitems" WHERE "categoryId" = 2 LIMIT 100;
On a new cluster same query throws error:
InvalidRequest: code=2200 [Invalid query] message="Undefined name categoryId in where clause ('categoryId = 2')"
but it runs perfectly fine when I remove double quotes
SELECT * FROM featureitems WHERE categoryId = 2 LIMIT 100;
It looks like some configuration issue, but I don't know where to look. Any suggestion in that sense is appreciated.
Cassandra converts all column/table/keyspace names to lowercase if not provided in double quotes.
So if you need uppercase character in column/table/keyspace name use double quotes.
You can use DESC TABLE featureitems
command to describe table.
In your first query you have enclosed categoryId
in double quotes, hence it looks for column with capital I.
In your second query categoryId
is not enclosed in double quotes, hence it will be converted to categoryid
... which is present in table and hence working.