ALTER KEYSPACE
Synopsis
The ALTER KEYSPACE
statement changes the properties of an existing keyspace.
This statement is supported for compatibility reasons only, and has no effect internally (no-op statement).
The statement can fail if the specified keyspace does not exist or if the user (role) has no permissions for the keyspace ALTER operation.
Syntax
Diagram
alter_keyspace
keyspace_properties
Grammar
alter_keyspace ::= ALTER { KEYSPACE | SCHEMA } keyspace_name
[ WITH REPLICATION '=' '{' keyspace_property '}']
[ AND DURABLE_WRITES '=' { true | false } ]
keyspace_property ::= property_name = property_value
Where
keyspace_name
andproperty_name
are identifiers.property_value
is a literal of either boolean, text, or map data type.
Semantics
- An error is raised if the specified
keyspace_name
does not exist. - An error is raised if the user (used role) has no ALTER permission for this specified keyspace and no ALTER permission for ALL KEYSPACES.
- CQL keyspace properties are supported in the syntax but have no effect internally (where YugabyteDB defaults are used instead).
Examples
cqlsh> ALTER KEYSPACE example;
cqlsh> ALTER KEYSPACE example WITH DURABLE_WRITES = true;
cqlsh> ALTER KEYSPACE example WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND DURABLE_WRITES = true;
cqlsh> ALTER SCHEMA keyspace_example;
SQL error: Keyspace Not Found.
ALTER SCHEMA keyspace_example;
^^^^^^
cqlsh> ALTER KEYSPACE example;
SQL error: Unauthorized. User test_role has no ALTER permission on <keyspace example> or any of its parents.
ALTER KEYSPACE example;
^^^^^^
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .