Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-16659

cqlsh 6.0.0 treats "config" as a reserved keyword

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0-rc2, 4.0
    • CQL/Interpreter
    • None

    Description

      Based on the information here from the Cassandra 4.0 RC1, "config" is not a keyword, and certainly is not a reserved keyword.

      However, Cassandra 4.0 RC1 / cqlsh 6.0.0 cannot fully agree:

      Connected to Test Cluster at 127.0.0.1:9042
      [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5]
      Use HELP for help.
      cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
      cqlsh> use config;
      Improper use command.
      cqlsh> desc config;
      Improper desc command.
      cqlsh> use "config";
      cqlsh:config> desc "config";
      CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
      cqlsh:config> 
      

      For reference:

      • Non-reserved keywords, such as "all", don't have the above problem. They can be used as keyspace name in any statement without quoting.
        Connected to Test Cluster at 127.0.0.1:9042
        [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5]
        Use HELP for help.
        cqlsh> create keyspace all WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
        cqlsh> use all;
        cqlsh:all> desc all;
        
        CREATE KEYSPACE all WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
        cqlsh:all> 
        
      • Reserved keywords, such as "add", can be used as keyspace name but requires quoting wherever it's used.
        Connected to Test Cluster at 127.0.0.1:9042
        [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5]
        Use HELP for help.
        cqlsh> create keyspace add WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
        SyntaxException: line 1:16 no viable alternative at input 'add' (create keyspace [add]...)
        cqlsh> create keyspace "add" WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
        cqlsh> use add;
        Improper use command.
        cqlsh> use "add";
        cqlsh:add> desc add;
        Improper desc command.
        cqlsh:add> desc "add";
        
        CREATE KEYSPACE "add" WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
        

      The treating of "config" in cqlsh 6.0.0 is somewhere in between, it can be used in the "create keyspace" statement without quoting, but requires quoting in the "use" and "desc" statements.

       
      I believe this is a bug in cqlsh 6.0.0, because it behaves the same way when it's connected to a Cassandra 3.11 cluster:

      Connected to Test Cluster at 127.0.0.1:9042
      [cqlsh 6.0.0 | Cassandra 3.11.10 | CQL spec 3.4.4 | Native protocol v4]
      Use HELP for help.
      cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
      cqlsh> use config;
      Improper use command.
      cqlsh> desc config;
      Improper desc command.
      cqlsh> use "config";
      cqlsh:config> 
      

      Yet cqlsh 5.0.1 doesn't have any issue at all:

      Connected to Test Cluster at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 3.11.10 | CQL spec 3.4.4 | Native protocol v4]
      Use HELP for help.
      cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
      cqlsh> use config;
      cqlsh:config> desc config;
      
      CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;
      
      cqlsh:config> 
      

      Attachments

        Issue Links

          Activity

            People

              e.dimitrova Ekaterina Dimitrova
              Bowen Song Bowen Song
              Ekaterina Dimitrova
              Adam Holmberg, Andres de la Peña
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: