Open
Description
This issue in cqlsh caused @juliayakovlev and me a lot of grief. It was also reported in Cassandra years ago - see https://issues.apache.org/jira/browse/CASSANDRA-8790 - but never solved.
The problem is that cqlsh escapes non-printable characters in text columns in a certain way, and then doesn't allow you to use the same format in queries. For example:
CREATE KEYSPACE ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor': 1 };
USE ks;
CREATE TABLE cf (pk text primary key);
INSERT INTO cf (pk) values ('^A'); # "^A" is control-A. Type control-V and then control
When we use SELECT we see the following:
pk
------
\x01
(1 rows)
Note how the character 1 (control-A) is shown here as '\x01'.
However, one cannot use this syntax on input: The string '\x01' is treated literally as those 4 characters, and not translated to character 1:
cqlsh:ks> select * from cf where pk='\x01';
pk
----
(0 rows)
To read this row, one needs to type control-A (usually control-V control-A) again.. But there's no way to guess this from the SELECT output.
cqlsh:ks> select * from cf where pk='^A';
pk
------
\x01
(1 rows)
Metadata
Assignees
Labels
No labels
Activity