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

Stefan Miklosovic edited comment on CASSANDRA-16916 at 7/4/24 12:21 PM:
------------------------------------------------------------------------

[~bereng]  [~blerer] 

 

I think this feature was broken on delivery. I think we did a pretty poor job 
while testing it as CASSANDRA-19749 shows.

this code: 
[https://github.com/apache/cassandra/commit/e137c7c34cc10d4f8c9124c6f9af17a44061ab1f#diff-9c7fbde9c5b432f9ce35424491d70e572567712cdfe08f048d5278bb9460223d]

IF you notice, it just tests the syntax when it comes to roles / users. It is 
actually never testing the functionality itself which CASSANDRA-19749 
discovered.

 
{code:java}
cassandra@cqlsh> ALTER ROLE IF EXISTS this_role_is_not_there WITH SUPERUSER = 
true ;
cassandra@cqlsh> select * from system_auth.roles; role                   | 
can_login | is_superuser | member_of | salted_hash
------------------------+-----------+--------------+-----------+--------------------------------------------------------------
 this_role_is_not_there |      null |         True |      null |                
                                         null
              cassandra |      True |         True |      null | 
$2a$10$.3sia/S1SL6Y7MTHN3DdUu79QnKdvcARLiIMCHgQLVOVaDZA1VnPW
 {code}


was (Author: smiklosovic):
[~bereng]  [~blerer] 

 

I think this feature was broken on delivery. I think we did a pretty poor job 
while testing it as CASSANDRA-19749 shows.

this code: 
[https://github.com/apache/cassandra/commit/e137c7c34cc10d4f8c9124c6f9af17a44061ab1f#diff-9c7fbde9c5b432f9ce35424491d70e572567712cdfe08f048d5278bb9460223d]

IF you notice, it just tests the syntax when it comes to roles / users. It is 
actually never testing the functionality itself which CASSANDRA-19749 
discovered.

> Add support for IF EXISTS and IF NOT EXISTS in ALTER statements
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-16916
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16916
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Syntax
>            Reporter: Benjamin Lerer
>            Assignee: Jogesh Anand
>            Priority: Normal
>             Fix For: 4.1-alpha1, 4.1
>
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> It would make sense to add support for {{IF EXISTS}} and {{IF NOT EXISTS}} in 
> the different {{ALTER}} statements. 
> For example:
> * {{ALTER TABLE IF EXISTS myTable ...}}
> * {{ALTER TABLE myTable ADD IF NOT EXISTS ...}}
> * {{ALTER TABLE myTable DROP IF EXISTS ...}}
> * {{ALTER TYPE IF EXISTS myType ...}}
> * {{ALTER TYPE myType ADD IF NOT EXISTS ...}}
> +Additional info for newcomers:+
> In order to implement this change you will need to change the {{Parser.g}} 
> ANTLR file located in the src/antlr directory and the java classes 
> corresponding to the different alter statements located in the 
> {{org.apache.cassandra.cql3.statements.schema}} package. You can look at the 
> CreateTableStatement class to see how it was done there.
> The unit test for the CQL logic are located under 
> {{org.apache.cassandra.cql3.validation}}



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