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

Limit user types to the keyspace they are defined in

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.1 rc1
    • Legacy/CQL
    • None
    • java version "1.7.0_51"
      cassandra from trunk, 4b54b8...

    • Normal

    Description

      I'm not 100% certain this is a bug.

      The current syntax for "alter type rename" requires the keyspace on the old and new table name (if a keyspace is not active). So, to rename the type 'foo' to 'bar', you have to issue this statement:
      ALTER TYPE ks.foo rename to ks.bar .

      As a result, this syntax will also allow renaming the type into another existing keyspace, which updates the metadata in system.schema_usertypes.

      I'm wondering if perhaps we can omit the second keyspace prefix and implicitly rename into the same keyspace.

      To reproduce:

      cqlsh> create keyspace user_types with replication = {'class':'SimpleStrategy', 'replication_factor':3} ;
      cqlsh> create keyspace user_types2 with replication = {'class':'SimpleStrategy', 'replication_factor':3} ;
      cqlsh> CREATE TYPE user_types.simple_type (user_number int);
      cqlsh> alter type user_types.simple_type rename to user_types2.simple_type;
      

      Renaming to another keyspace is also possible when a keyspace is active, like so:

      cqlsh:user_types> alter type simple_type rename to user_types2.simple_type;
      

      Attachments

        1. 6643.txt
          4 kB
          Sylvain Lebresne

        Activity

          People

            slebresne Sylvain Lebresne
            rhatch Russ Hatch
            Sylvain Lebresne
            Aleksey Yeschenko
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: