You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aleksandr Sorokoumov (Jira)" <ji...@apache.org> on 2021/07/02 18:03:00 UTC

[jira] [Commented] (CASSANDRA-15663) DESCRIBE KEYSPACE does not properly quote table names

    [ https://issues.apache.org/jira/browse/CASSANDRA-15663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17373711#comment-17373711 ] 

Aleksandr Sorokoumov commented on CASSANDRA-15663:
--------------------------------------------------

Unfortunately, solving this issue by porting CASSANDRA-16659 will be even more invasive than upgrading and patching drivers.

The difficulty lies in pylib relying heavily on the drivers to escape and convert statements to strings. For example:
* {{cql3handling.py}}, {{copyutil.py}}, {{cqlsh.py}} use {{maybe_escape_name}}, {{protect_name}}, {{protect_names}} functions from the driver that in turn use driver's list of reserved keywords.
* Use of {{export_as_string}} in {{cqlsh.py}} which in turn calls the same method for parts of the statements - aggregates, functions, etc. 
 
The former is easy to fix, e.g., by copying these functions to {{cql3handling.py}}. However, to solve the latter, we'll have to copy over the vast majority of the driver's [metadata.py|https://github.com/datastax/python-driver/blob/master/cassandra/metadata.py]. 

WDYT?

> DESCRIBE KEYSPACE does not properly quote table names
> -----------------------------------------------------
>
>                 Key: CASSANDRA-15663
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15663
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Syntax
>            Reporter: Oskar Liljeblad
>            Assignee: Aleksandr Sorokoumov
>            Priority: Normal
>              Labels: pull-request-available
>             Fix For: 3.11.x
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> How to reproduce (3.11.6) - cqlsh:
> {code}
> CREATE KEYSPACE test1 WITH replication = \{'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
> CREATE TABLE test1."default" (id text PRIMARY KEY, data text, etag text);
> DESCRIBE KEYSPACE test1;
> {code}
> Output will be:
> {code}
> CREATE TABLE test1.default (
>  id text PRIMARY KEY,
>  data text,
>  etag text
> ) WITH [..]
> {code}
> Output should be:
> {code}
> CREATE TABLE test1."default" (
>  id text PRIMARY KEY,
>  data text,
>  etag text
> ) WITH [..]
> {code}
>  If you try to run {{CREATE TABLE test1.default [..]}} you will get an error 
> SyntaxException: line 1:19 no viable alternative at input 'default' (CREATE TABLE test1.[default]...)
> Oskar Liljeblad
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org