cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-6643) Limit user types to the keyspace they are defined in
Date Wed, 26 Mar 2014 13:33:16 GMT

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

Sylvain Lebresne commented on CASSANDRA-6643:
---------------------------------------------

In
{noformat}
USE ks2;
CREATE TABLE ks1.mytable (k mytype PRIMARY KEY);
{noformat}
The keyspace for mytype (where we're look for mytype to be precise) could {{ks2}} (the logged
keyspace) or {{ks1}} (the statement keyspace). Of course this only matter if you mix some
fully-qualified names and some non-fully-qualifed ones, which is probably a bad idea in the
first place, but well, still need to handle it. 

> Limit user types to the keyspace they are defined in
> ----------------------------------------------------
>
>                 Key: CASSANDRA-6643
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6643
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: java version "1.7.0_51"
> cassandra from trunk, 4b54b8...
>            Reporter: Russ Hatch
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>             Fix For: 2.1 beta2
>
>         Attachments: 6643.txt
>
>
> 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:
> {noformat}
> 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;
> {noformat}
> Renaming to another keyspace is also possible when a keyspace is active, like so:
> {noformat}
> cqlsh:user_types> alter type simple_type rename to user_types2.simple_type;
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message