Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad Request: Invalid STRING constant ... of type timeuuid

Tags:

cassandra

When I do select * from "TableToFetch" where column1='2js88saa-33oo-pzl7-b517-8584j2kf8wdd'; I get this error:

Bad Request: Invalid STRING constant (2js88saa-33oo-pzl7-b517-8584j2kf8wdd) for column1 of type timeuuid

These didn't help:

select * from "TableToFetch" where column1="2js88saa-33oo-pzl7-b517-8584j2kf8wdd"; returns

Bad Request: line 1:52 no viable alternative at input '2js88saa-33oo-pzl7-b517-8584j2kf8wdd'

select * from "TableToFetch" where column1=2js88saa-33oo-pzl7-b517-8584j2kf8wdd; returns

Bad Request: TimeUUID supports only version 1 UUIDs

What do I do?

like image 536
AmazingDayToday Avatar asked Dec 23 '22 22:12

AmazingDayToday


1 Answers

The first two errors is caused by the fact that you wrap your uuid with quotes: the first one gets interpreted as string, the second one does not get recognized as any type.

UUID and TimeUUID can/should be used in queries without any quotes.

The third error message is regarding the TimeUUID type, Apache Cassandra uses UUID of type 1, so it seems that 2js88saa-33oo-pzl7-b517-8584j2kf8wdd is probably not a valid type 1 UUID. Your query seems to be ok, to me.

Also I am not sure how do you execute your query (cql or via driver) or what version of Cassandra do you use, but this answer might be relevant for you, too:

https://stackoverflow.com/a/17946236/9020666

like image 141
Andrea Nagy Avatar answered Jan 09 '23 17:01

Andrea Nagy