Copilot commented on code in PR #4112:
URL: https://github.com/apache/cassandra/pull/4112#discussion_r2621516535


##########
doc/modules/cassandra/pages/developing/cql/security.adoc:
##########
@@ -346,6 +346,59 @@ include::cassandra:example$BNF/list_users_statement.bnf[]
 
 Note that this statement is equivalent to 
xref:security.adoc#list-roles-statement[`LIST ROLES], but only roles with the 
`LOGIN` privilege are included in the output.
 
+[[databaseIdentity]]
+=== Database Identities
+
+[[AddIdentityStmt]]
+==== ADD IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE role_name

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator. It should likely be 'add_identity_statement ::= ADD IDENTITY [ 
IF NOT EXISTS ] id_name TO ROLE role_name'.
   ```suggestion
   add_identity_statement ::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE 
role_name
   ```



##########
doc/modules/cassandra/pages/developing/cql/security.adoc:
##########
@@ -346,6 +346,59 @@ include::cassandra:example$BNF/list_users_statement.bnf[]
 
 Note that this statement is equivalent to 
xref:security.adoc#list-roles-statement[`LIST ROLES], but only roles with the 
`LOGIN` privilege are included in the output.
 
+[[databaseIdentity]]
+=== Database Identities
+
+[[AddIdentityStmt]]
+==== ADD IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE role_name
+
+_Sample:_
+
+[source,sql]
+ADD IDENTITY 'id1' TO ROLE 'role1';
+
+Only a user with privileges to add roles can add identities
+
+Role names & Identity names should be quoted if they contain non-alphanumeric 
characters.
+
+[[addIdentityConditional]]
+===== Adding an identity conditionally
+
+Attempting to add an existing identity results in an invalid query
+condition unless the `IF NOT EXISTS` option is used. If the option is
+used and the identity exists, the statement is a no-op.
+
+[source,sql]
+ADD IDENTITY [ IF NOT EXISTS ] 'id1' TO ROLE 'role1';
+
+[[dropIdentityStmt]]
+==== DROP IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= DROP IDENTITY [ IF EXISTS ]
+
+_Sample:_
+
+[source,sql]
+----
+DROP IDENTITY 'testIdentity';
+DROP IDENTITY IF EXISTS 'testIdentity';
+----
+
+Only a user with privileges to drop roles can remove identities
+
+Attempting to drop an Identity which does not exist results in an invalid

Review Comment:
   The capitalization of "Identity" is inconsistent with the rest of the 
documentation which uses "identity" in lowercase when referring to the database 
concept. This should be "identity" to match line 399 and other similar 
references.
   ```suggestion
   Attempting to drop an identity which does not exist results in an invalid
   ```



##########
doc/modules/cassandra/pages/developing/cql/security.adoc:
##########
@@ -346,6 +346,59 @@ include::cassandra:example$BNF/list_users_statement.bnf[]
 
 Note that this statement is equivalent to 
xref:security.adoc#list-roles-statement[`LIST ROLES], but only roles with the 
`LOGIN` privilege are included in the output.
 
+[[databaseIdentity]]
+=== Database Identities
+
+[[AddIdentityStmt]]
+==== ADD IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE role_name
+
+_Sample:_
+
+[source,sql]
+ADD IDENTITY 'id1' TO ROLE 'role1';
+
+Only a user with privileges to add roles can add identities
+
+Role names & Identity names should be quoted if they contain non-alphanumeric 
characters.
+
+[[addIdentityConditional]]
+===== Adding an identity conditionally
+
+Attempting to add an existing identity results in an invalid query
+condition unless the `IF NOT EXISTS` option is used. If the option is
+used and the identity exists, the statement is a no-op.
+
+[source,sql]
+ADD IDENTITY [ IF NOT EXISTS ] 'id1' TO ROLE 'role1';
+
+[[dropIdentityStmt]]
+==== DROP IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= DROP IDENTITY [ IF EXISTS ]
+
+_Sample:_
+
+[source,sql]
+----
+DROP IDENTITY 'testIdentity';
+DROP IDENTITY IF EXISTS 'testIdentity';
+----
+
+Only a user with privileges to drop roles can remove identities

Review Comment:
   The sentence is missing ending punctuation. Add a period at the end of the 
sentence.
   ```suggestion
   Only a user with privileges to drop roles can remove identities.
   ```



##########
doc/modules/cassandra/pages/developing/cql/cql_singlefile.adoc:
##########
@@ -1066,10 +1066,10 @@ _Syntax:_
 
 [source,bnf]
 ----
-::= ALTER TYPE (IF EXISTS)?
+::= ALTER TYPE [ IF EXISTS ]

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator and should reference a type name. It should likely be 
'alter_type_statement ::= ALTER TYPE [ IF EXISTS ] type_name ...'.



##########
doc/modules/cassandra/pages/developing/cql/cql_singlefile.adoc:
##########
@@ -1090,7 +1090,7 @@ type of existing fields. If the type does not exist, the 
statement will return a
 _Syntax:_
 
 [source,bnf]
-::= DROP TYPE ( IF EXISTS )?
+::= DROP TYPE [ IF EXISTS ]

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator and include the type name parameter. It should likely be 
'drop_type_statement ::= DROP TYPE [ IF EXISTS ] type_name'.
   ```suggestion
   drop_type_statement ::= DROP TYPE [ IF EXISTS ] type_name
   ```



##########
doc/modules/cassandra/pages/developing/cql/cql_singlefile.adoc:
##########
@@ -1066,10 +1066,10 @@ _Syntax:_
 
 [source,bnf]
 ----
-::= ALTER TYPE (IF EXISTS)?
+::= ALTER TYPE [ IF EXISTS ]
 
-::= ADD (IF NOT EXISTS)?
-| RENAME (IF EXISTS)? TO ( AND TO )*
+::= ADD [ IF NOT EXISTS ]
+| RENAME [ IF EXISTS ] TO ( AND TO )*

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator. These appear to be production rules for the alter_type_action 
and should likely be 'alter_type_action ::= ADD [ IF NOT EXISTS ] ... || RENAME 
[ IF EXISTS ] ...'.



##########
doc/modules/cassandra/pages/developing/cql/security.adoc:
##########
@@ -346,6 +346,59 @@ include::cassandra:example$BNF/list_users_statement.bnf[]
 
 Note that this statement is equivalent to 
xref:security.adoc#list-roles-statement[`LIST ROLES], but only roles with the 
`LOGIN` privilege are included in the output.
 
+[[databaseIdentity]]
+=== Database Identities
+
+[[AddIdentityStmt]]
+==== ADD IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE role_name
+
+_Sample:_
+
+[source,sql]
+ADD IDENTITY 'id1' TO ROLE 'role1';
+
+Only a user with privileges to add roles can add identities

Review Comment:
   The sentence is missing ending punctuation. Add a period at the end of the 
sentence.
   ```suggestion
   Only a user with privileges to add roles can add identities.
   ```



##########
doc/modules/cassandra/pages/developing/cql/security.adoc:
##########
@@ -346,6 +346,59 @@ include::cassandra:example$BNF/list_users_statement.bnf[]
 
 Note that this statement is equivalent to 
xref:security.adoc#list-roles-statement[`LIST ROLES], but only roles with the 
`LOGIN` privilege are included in the output.
 
+[[databaseIdentity]]
+=== Database Identities
+
+[[AddIdentityStmt]]
+==== ADD IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= ADD IDENTITY [ IF NOT EXISTS ] id_name TO ROLE role_name
+
+_Sample:_
+
+[source,sql]
+ADD IDENTITY 'id1' TO ROLE 'role1';
+
+Only a user with privileges to add roles can add identities
+
+Role names & Identity names should be quoted if they contain non-alphanumeric 
characters.
+
+[[addIdentityConditional]]
+===== Adding an identity conditionally
+
+Attempting to add an existing identity results in an invalid query
+condition unless the `IF NOT EXISTS` option is used. If the option is
+used and the identity exists, the statement is a no-op.
+
+[source,sql]
+ADD IDENTITY [ IF NOT EXISTS ] 'id1' TO ROLE 'role1';
+
+[[dropIdentityStmt]]
+==== DROP IDENTITY
+
+_Syntax:_
+
+[source,bnf]
+::= DROP IDENTITY [ IF EXISTS ]

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator and the right-hand side is also incomplete (missing the identity 
name parameter). It should likely be 'drop_identity_statement ::= DROP IDENTITY 
[ IF EXISTS ] id_name'.
   ```suggestion
   drop_identity_statement ::= DROP IDENTITY [ IF EXISTS ] id_name
   ```



##########
doc/modules/cassandra/pages/developing/cql/cql_singlefile.adoc:
##########
@@ -377,7 +377,7 @@ link:#createKeyspaceStmt[`CREATE KEYSPACE`] statement.
 _Syntax:_
 
 [source,bnf]
-::= DROP KEYSPACE ( IF EXISTS )?
+::= DROP KEYSPACE [ IF EXISTS ]

Review Comment:
   The BNF syntax is incomplete. It should have a left-hand side before the 
'::=' operator and include the keyspace name parameter. It should likely be 
'drop_keyspace_statement ::= DROP KEYSPACE [ IF EXISTS ] keyspace_name'.
   ```suggestion
   drop_keyspace_statement ::= DROP KEYSPACE [ IF EXISTS ] keyspace_name
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to