Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cqlsh - inconsistent escaping of non-printable characters #54

Open
nyh opened this issue Oct 29, 2018 · 0 comments
Open

cqlsh - inconsistent escaping of non-printable characters #54

nyh opened this issue Oct 29, 2018 · 0 comments

Comments

@nyh
Copy link

nyh commented Oct 29, 2018

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)
@nyh nyh changed the title cqlsh - inconsistent escaping of non-printable character.input and output cqlsh - inconsistent escaping of non-printable characters Oct 29, 2018
@mykaul mykaul transferred this issue from scylladb/scylladb Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant