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

Brandon Williams commented on CASSANDRA-18628:
----------------------------------------------

I think you just need to quote the column name:

{noformat}
cqlsh> SELECT c2, ds, "Is", c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 
'teststring1' AND c3 = 'teststring2' AND rJr = -1012111692; 

 c2 | ds | Is | c4
----+----+----+----

(0 rows)
{noformat}

> Handle special column name when upgrading from 2.2.19 to 3.0.29/3.11.15
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-18628
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18628
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Ke Han
>            Priority: Normal
>
> When I was migrating from 2.2.19 to 3.0.29/3.11.15, I noticed some of my 
> columns could not be accessed because of the syntax problem. I had a column 
> named "Is" in the 2.x. However, after the upgrade process, when I try to 
> perform the same select command, it throws an exception since "Is" will be 
> interpreted separately. 
> I observed this after my cluster was fully upgraded. I cannot downgrade it 
> back to 2.2.19. I cannot rename this column directly either.
> h2. Steps to reproduce
> Execute the following commands in Cassandra-2.2.19 (single node)
> {code:java}
> CREATE KEYSPACE  ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 
> 'replication_factor' : 2 };
> CREATE TABLE IF NOT EXISTS ks.tb (c1 INT,c2 INT,c3 TEXT,rJr INT,c4 TEXT,c5 
> TEXT,ds INT, Is INT,
> PRIMARY KEY (c2, c5, c3, rJr, Is, c1, ds, c4 ));
> SELECT c2, ds, Is, c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 'teststring1' 
> AND c3 = 'teststring2' AND rJr = -1012111692; 
>  c2 | ds | is | c4
> ----+----+----+----
> (0 rows){code}
> Then perform an upgrade to Cassandra-3.0.29/Cassandra-3.11.15
> {code:java}
> // Do the same select
> SELECT c2, ds, Is, c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 'teststring1' 
> AND c3 = 'teststring2' AND rJr = -1012111692; 
> SyntaxException: line 1:15 no viable alternative at input 'Is' (SELECT c2, 
> ds, [Is]...){code}
> The column still exists in the table, but I cannot access it.
> I am wondering whether I can directly rename it in the new version or get 
> some prompts telling me to rename is before the upgrade process. "Is" is also 
> not marked as a reserved word in the [CQL Keywords 
> doc|https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/keywords_r.html]).
> Any help is appreciated!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to