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

Jack Krupansky commented on CASSANDRA-7683:
-------------------------------------------

bq.  I execute an `ALTER TABLE IF EXISTS`.

Ummm... there's no such command, at least in the CQL3 spec! I suspect that you 
simply meant "CREATE TABLE IF NOT EXISTS".

Assumming that, I think the CQL3 spec suggests that you should indeed be able 
to do what you suggest - or the spec needs to be revised to specifically 
disallow it:

{code}
Attempting to create an already existing table will return an error unless the 
IF NOT EXISTS option is used. If it is used, the statement will be a no-op if 
the table already exists.
{code}

So, unless, somebody wants to propose changing that second sentence to "If it 
is used, the statement will be a no-op if the table already exists, unless the 
user does not have CREATE permission, in which case the request will return an 
error" the Wish should be considered reasonable.

Personally, this one seems to be in a very gray area - fielder's choice, flip a 
coin.

Maybe the proper argument to make here is that the user wishes to have a single 
script that can be used by a range of users and for completeness includes the 
CREATE TABLE so it can be used for initial as well as incremental operations. 
It that context it would make sense, but... I may be reading too much into the 
users' intentions!


> Always allow CREATE TABLE IF NOT EXISTS if it exists
> ----------------------------------------------------
>
>                 Key: CASSANDRA-7683
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7683
>             Project: Cassandra
>          Issue Type: Wish
>          Components: Core
>            Reporter: Jens Rantil
>            Priority: Minor
>
> Background: I have a table that I'd like to make sure exists when I boot up 
> my application. To make the life easier for our developers I execute an 
> `ALTER TABLE IF EXISTS`.
> In production I am using user based authorization and for security reasons 
> regular production users are not allowed to CREATE TABLEs.
> Problem: When a user without CREATE permission executes `ALTER TABLE IF 
> EXISTS` for a table that already exists, the command fails telling me the 
> user is not allowed to execute `CREATE TABLE`. It feels kinda ridiculous that 
> this fails when I'm not actually creating the table.
> Proposal: That the permission check only should be done if the table is only 
> actually to be created. 
> Workaround: Right now, I have a boolean that checks if in production and in 
> that case don't try to create the table. Another approach would be to 
> manually check if the table exists.



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

Reply via email to