You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jonathan Ellis (JIRA)" <ji...@apache.org> on 2014/05/11 00:13:39 UTC

[jira] [Commented] (CASSANDRA-6643) Limit user types to the keyspace they are defined in

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

Jonathan Ellis commented on CASSANDRA-6643:
-------------------------------------------

bq. contrarily to what I said just above, if we do so, I don't think we'll be able to change our mind later and allow referencing other keyspace type

Why is that?

bq. I wonder if saying "non qualified type and table names always refer to the logged keyspace" wouldn't be simpler 

I think "type names always refer to the statement keyspace" makes the most sense; if we don't allow referencing types in a different keyspace, then referring to the logged keyspace is an error.

If we want to help people out, we could raise an error if there is ambiguity and require explicitly specifying ks1.mytype if ks1 and ks2 both have a mytype defined.

> 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 rc1
>
>         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)