-
Couldn't load subscription status.
- Fork 19
[DOC-11643] New SQL++ Statements for 8.0 #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
30980a2
grant and revoke stmts
rakhi-prathap 5252e36
Add CREATE USER
rakhi-prathap 58c8ef5
Add ALTER USER
rakhi-prathap 4731c5b
Add DROP
rakhi-prathap 5328f1f
Add CREATE GROUP
rakhi-prathap 3e86640
Update CREATE GROUP
rakhi-prathap 55aa690
Add DROP GROUP
rakhi-prathap ba73be1
Update GRANT
rakhi-prathap 60edf44
Update REVOKE
rakhi-prathap cf25385
More statements
rakhi-prathap fd4346d
Minor edits to GRANT and REVOKE
rakhi-prathap b6c0737
Adding new SQL++ statements
rakhi-prathap 78e51fb
Update GRANT and REVOKE statements
rakhi-prathap cdc68fb
Refine the content
rakhi-prathap 240aea3
Update HEAD.yml
rakhi-prathap 67aa778
Add a custom preview.yml
rakhi-prathap 1b5fcb9
Revert preview.yml changes
rakhi-prathap da20aa2
Incorporating tech review feedback
rakhi-prathap b2bac7b
Incorporating tech review feedback
rakhi-prathap f866dd7
Add new examples using IF EXISTS/IF NOT EXISTS
rakhi-prathap 0f01135
Apply suggestions from code review
rakhi-prathap e037fc1
Apply changes from review
rakhi-prathap 391a3bc
Apply suggestions from code review
rakhi-prathap f371eaa
Apply suggestions from code review
rakhi-prathap eaf1021
Minor fix
rakhi-prathap f6823c7
Apply suggestions from code review
rakhi-prathap 0566c24
Update EBNF to remove quotes
rakhi-prathap 13473f9
Resolve conflicts
rakhi-prathap a60f34e
Add drop-bucket to the drop-statement list
rakhi-prathap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.66 KB
(140%)
modules/n1ql/assets/images/n1ql-language-reference/create-statement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.05 KB
(140%)
modules/n1ql/assets/images/n1ql-language-reference/drop-statement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.87 KB
(44%)
modules/n1ql/assets/images/n1ql-language-reference/grant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.85 KB
(160%)
modules/n1ql/assets/images/n1ql-language-reference/other-statement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.02 KB
(46%)
modules/n1ql/assets/images/n1ql-language-reference/revoke.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions
77
modules/n1ql/pages/n1ql-language-reference/alterbucket.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| = ALTER BUCKET | ||
| :description: The ALTER BUCKET statement enables you to update an existing bucket's configuration. | ||
| :page-topic-type: reference | ||
| :page-status: Couchbase Server 8.0 | ||
| :imagesdir: ../../assets/images | ||
|
|
||
| :identifier: xref:n1ql-language-reference/identifiers.adoc | ||
| :roles: xref:learn:security/roles.adoc | ||
| :bucket-parameters: xref:rest-api:rest-bucket-create.adoc#parameter-groups | ||
| :buckets: xref:learn:buckets-memory-and-storage/buckets.adoc | ||
| :manage-buckets: xref:manage:manage-buckets/bucket-management-overview.adoc | ||
| :buckets-api: xref:rest-api:rest-bucket-intro.adoc | ||
| :couchbase-cli-bucket-edit: xref:cli:cbcli/couchbase-cli-bucket-edit.adoc | ||
|
|
||
| [abstract] | ||
| {description} | ||
|
|
||
| == Purpose | ||
|
|
||
| Use the ALTER BUCKET statement to modify the configuration of a bucket in your Couchbase cluster. | ||
| You can update only a limited set of bucket settings. | ||
| You cannot change its core properties such as the bucket name and type. | ||
| For more information, see the <<alterbucket-syntax,Syntax>> section. | ||
|
|
||
| == RBAC Privileges | ||
|
|
||
| Only administrators with the following roles can execute the ALTER BUCKET statement: | ||
|
|
||
| * Full Admin | ||
| * Cluster Admin | ||
| * Bucket Admin (if privileges are extended to the specific bucket or all buckets on the cluster) | ||
|
|
||
| For more information about roles and privileges, see {roles}[Roles]. | ||
|
|
||
| [[alterbucket-syntax]] | ||
| == Syntax | ||
|
|
||
| [source,ebnf] | ||
| ---- | ||
| include::partial$grammar/ddl.ebnf[tag=alter-bucket] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/alter-bucket.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| The `BUCKET` and `DATABASE` keywords are synonyms. | ||
| You can use either of them. | ||
|
|
||
| [horizontal] | ||
| name:: | ||
| (Required) An {identifier}[identifier] that represents the name of the bucket that you want to update. | ||
|
|
||
| with-fields:: (Optional) | ||
| A JSON object containing a list of name-value pairs that specify additional options for the bucket. | ||
| For a list of valid fields names and values, see {bucket-parameters}[Bucket Parameter Groups] in the REST API documentation. | ||
|
|
||
| NOTE: You cannot alter the following fields of a bucket: `bucketType`, `storageBackend`, `replicaIndex`, and `conflictResolutionType`. | ||
|
|
||
| == Example | ||
|
|
||
| .Alter a bucket and update its memory quota, maximum TTL, and durability level | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER BUCKET `student-records` | ||
| WITH { | ||
| "ramQuota": 256, | ||
| "maxTTL": 86400, | ||
| "durabilityMinLevel": "majority" | ||
| }; | ||
| ---- | ||
| ==== | ||
|
|
||
| == Related Links | ||
|
|
||
| * For an overview of buckets, see {buckets}[Buckets]. | ||
| * For step-by-step procedures for bucket management, see {manage-buckets}[Manage Buckets]. | ||
| * For managing buckets with the REST API, see {buckets-api}[Buckets API]. | ||
142 changes: 142 additions & 0 deletions
142
modules/n1ql/pages/n1ql-language-reference/altergroup.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| = ALTER GROUP | ||
| :description: The ALTER GROUP statement enables you to update an existing group. | ||
| :page-topic-type: reference | ||
rakhi-prathap marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :page-status: Couchbase Server 8.0 | ||
| :imagesdir: ../../assets/images | ||
|
|
||
| :from: xref:n1ql-language-reference/from.adoc | ||
| :from-keyspace-ref: {from}#from-keyspace-ref | ||
|
|
||
| [abstract] | ||
| {description} | ||
|
|
||
| == Purpose | ||
|
|
||
| Use the ALTER GROUP statement to modify an existing group within the Couchbase Server Role-Based Access Control (RBAC) system. | ||
| You can update the group's description and its roles. | ||
| You can either add new roles or remove all the existing ones. | ||
| When you update a role for a group, all users in the group inherit the updated permissions automatically. | ||
|
|
||
| CAUTION: When you add new roles to a group, the ALTER GROUP statement replaces the group's existing role assignments with the new ones you provide. | ||
| It updates the entire role list, so any existing roles not included in the new list will be removed. | ||
| If you want to add or remove specific roles without affecting the others, use the xref:n1ql:n1ql-language-reference/grant.adoc[GRANT] and xref:n1ql:n1ql-language-reference/revoke.adoc[REVOKE] statements instead. | ||
|
|
||
| == RBAC Privileges | ||
|
|
||
| To execute the ALTER GROUP statement, you must have either the Full Admin or the Security Admin role. | ||
| For more information about user roles, see xref:learn:security/authorization-overview.adoc[Authorization]. | ||
|
|
||
| == Syntax | ||
|
|
||
| [source,ebnf] | ||
| ---- | ||
| include::partial$grammar/ddl.ebnf[tag=alter-group] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/alter-group.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| [horizontal] | ||
| name:: | ||
| (Required) The unique identifier of the group you want to update. | ||
|
|
||
| description:: | ||
| (Optional) A quoted string containing the updated description for the group. | ||
|
|
||
| rbac-role:: | ||
| (Optional) | ||
| <<roles,Update Roles>> | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| When altering a group, you can update its roles using one of the following options: `ROLE`, `ROLES`, or `NO ROLES`. | ||
| You can specify only one of these options per statement. | ||
|
|
||
| * `ROLE` assigns a single role to the group. | ||
| * `ROLES` assigns multiple roles to group (the names must be separated by commas). | ||
| * `NO ROLES` removes all roles from the group. | ||
| ==== | ||
|
|
||
| [[roles]] | ||
| === Update Roles | ||
|
|
||
| [source,ebnf] | ||
| ---- | ||
| include::partial$grammar/ddl.ebnf[tag=rbac-role] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/rbac-role.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| [horizontal] | ||
|
|
||
| role:: | ||
| One of the xref:learn:security/authorization-overview.adoc[RBAC role names predefined] by Couchbase Server. | ||
| + | ||
| The following roles have short forms that can be used as well: | ||
|
|
||
| * `query_select` → `select` | ||
| * `query_insert` → `insert` | ||
| * `query_update` → `update` | ||
| * `query_delete` → `delete` | ||
|
|
||
| keyspace-ref:: <<keyspace-ref>> | ||
|
|
||
| [[keyspace-ref]] | ||
| ==== Keyspace Reference | ||
|
|
||
| [source,ebnf] | ||
| ---- | ||
| include::partial$grammar/dql.ebnf[tag=keyspace-ref] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/keyspace-ref.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| [source#keyspace-path,ebnf,reftext="keyspace path"] | ||
| ---- | ||
| include::partial$grammar/dql.ebnf[tag=keyspace-path] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/keyspace-path.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| [source#keyspace-partial,ebnf,reftext="keyspace partial"] | ||
| ---- | ||
| include::partial$grammar/dql.ebnf[tag=keyspace-partial] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/keyspace-partial.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| Use keyspace reference to specify the target for the update. | ||
| For more information about each element, see the xref:n1ql-language-reference/from.adoc#from-keyspace-ref[Keyspace Reference] section in the FROM clause. | ||
|
|
||
| == Examples | ||
|
|
||
| .Alter a group and update its description | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER GROUP support WITH "Support team for customer queries"; | ||
| ---- | ||
| ==== | ||
|
|
||
| .Alter a group and add new roles | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER GROUP support | ||
| ROLES | ||
| query_select ON `travel-sample`.`inventory`.`airline`, | ||
| query_insert ON `travel-sample`.`inventory`.`airline`; | ||
| ---- | ||
| ==== | ||
|
|
||
| .Alter a group and remove all roles | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER GROUP support NO ROLES WITH "Currently unused group"; | ||
| ---- | ||
| ==== | ||
|
|
||
| == Related Links | ||
| * To create a group, see xref:n1ql-language-reference/creategroup.adoc[]. | ||
| * To delete a group, see xref:n1ql-language-reference/altergroup.adoc[]. | ||
| * To create a new user, see xref:n1ql-language-reference/createuser.adoc[]. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| = ALTER USER | ||
| :description: The ALTER USER statement enables you to alter the details of an existing user. | ||
| :page-topic-type: reference | ||
rakhi-prathap marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| :page-status: Couchbase Server 8.0 | ||
| :imagesdir: ../../assets/images | ||
|
|
||
| [abstract] | ||
| {description} | ||
|
|
||
| == Purpose | ||
|
|
||
| Use the ALTER USER statement to update a local user's attributes, such as their password, full name, and group. | ||
| You can add the user to new groups or remove them from all existing groups. | ||
|
|
||
| This statement helps manage access control and keeps user information up to date within Couchbase Server. | ||
|
|
||
| CAUTION: When you add new groups to a user, the ALTER USER statement replaces the user's existing group assignments with the new ones you provide. | ||
| It updates the entire group list, so any existing groups not included in the new list will be removed. | ||
|
|
||
| == RBAC Privileges | ||
|
|
||
| To execute the ALTER USER statement, you must have either the Full Admin or the Security Admin role. | ||
| For more information about user roles, see xref:learn:security/authorization-overview.adoc[Authorization]. | ||
|
|
||
| == Syntax | ||
|
|
||
| [source,ebnf] | ||
| ---- | ||
| include::partial$grammar/ddl.ebnf[tag=alter-user] | ||
| ---- | ||
|
|
||
| image::n1ql-language-reference/alter-user.png["Syntax diagram: refer to source code listing", align=left] | ||
|
|
||
| [horizontal] | ||
| username:: | ||
| (Required) The unique identifier of the local user. | ||
|
|
||
| password:: | ||
| (Optional) A quoted string containing the user's new password. | ||
| It must be at least 6 characters long. | ||
|
|
||
| name:: | ||
| (Optional) A quoted string containing the user's updated name. | ||
|
|
||
| group:: | ||
| (Optional) The group you want to assign the user to. | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| When altering a user, you can update their group using one of the following options: `GROUP`, `GROUPS`, or `NO GROUPS`. | ||
| You can specify only one of these options per statement. | ||
|
|
||
| * `GROUP` assigns the user to a single group. | ||
| * `GROUPS` assigns the user to multiple groups (the names must be separated by commas). | ||
| * `NO GROUPS` removes the user from all groups. | ||
| ==== | ||
|
|
||
| == Examples | ||
|
|
||
| .Change a user's password and full name | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER USER Hilary PASSWORD "newpassword" WITH "Hilary Chloe"; | ||
| ---- | ||
| ==== | ||
|
|
||
| .Assign a user to a new group | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER USER Alice GROUP support; | ||
| ---- | ||
| ==== | ||
|
|
||
| .Remove a user from existing groups | ||
| ==== | ||
| [source,sqlpp] | ||
| ---- | ||
| ALTER USER Bob NO GROUPS; | ||
| ---- | ||
| ==== | ||
|
|
||
| == Related Links | ||
| * To create a new user, see xref:n1ql:n1ql-language-reference/createuser.adoc[]. | ||
| * To delete a user, see xref:n1ql:n1ql-language-reference/dropuser.adoc[]. | ||
| * To create a new group, see xref:n1ql:n1ql-language-reference/creategroup.adoc[]. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.