Skip to content

Commit 976d5c9

Browse files
committed
Allow DB owner to set session var defaults in DB
Fixes DOC-14457
1 parent 90d91b5 commit 976d5c9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/current/v25.4/alter-database.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ For usage, see [Synopsis](#synopsis).
355355

356356
#### Required privileges
357357

358-
No [privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#managing-privileges) are required to reset a session setting.
358+
To reset default session variable values for a database with `ALTER DATABASE ... RESET {session variable}`, the user must be a member of the [`admin` role]({% link {{ page.version.version }}/security-reference/authorization.md %}#admin-role) or the [owner]({% link {{ page.version.version }}/security-reference/authorization.md %}#object-ownership) of the target database.
359+
360+
All other session variables do not require [privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#managing-privileges) to modify.
359361

360362
#### Parameters
361363

@@ -379,7 +381,9 @@ In CockroachDB, the following are aliases for `ALTER DATABASE ... RESET {session
379381

380382
#### Required privileges
381383

382-
To set the `role` session variable, the current user must be a member of the `admin` role, or a member of the target role.
384+
To set default session variable values for a database with `ALTER DATABASE ... SET {session variable}`, the user must be a member of the [`admin` role]({% link {{ page.version.version }}/security-reference/authorization.md %}#admin-role) or the [owner]({% link {{ page.version.version }}/security-reference/authorization.md %}#object-ownership) of the target database.
385+
386+
Additionally, to set the `role` session variable, the current user must be a member of the `admin` role or a member of the target role.
383387

384388
All other session variables do not require [privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#managing-privileges) to modify.
385389

src/current/v25.4/alter-role.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Password creation and alteration is supported only in secure clusters.
2323

2424
- To alter an [`admin` role]({% link {{ page.version.version }}/security-reference/authorization.md %}#admin-role), the user must be a member of the `admin` role.
2525
- To alter other roles, the user must be a member of the `admin` role or have the [`CREATEROLE`]({% link {{ page.version.version }}/create-role.md %}#create-a-role-that-can-create-other-roles-and-manage-authentication-methods-for-the-new-roles) [role option](#role-options).
26+
- {% include_cached new-in.html version="v25.4" %} For [per-database defaults](#set-default-session-variable-values-for-a-specific-database), the [owner]({% link {{ page.version.version }}/security-reference/authorization.md %}#object-ownership) of a database can execute `ALTER ROLE ALL IN DATABASE ... {SET|RESET}` for that database (in addition to users who meet the general requirements above).
2627

2728
## Synopsis
2829

@@ -228,6 +229,8 @@ SHOW statement_timeout;
228229

229230
In the following example, the `root` user creates a database named `movr`, and sets the default value of the `timezone` [session variable]({% link {{ page.version.version }}/set-vars.md %}#supported-variables) for all roles in that database.
230231

232+
{% include_cached new-in.html version="v25.4" %} The [owner]({% link {{ page.version.version }}/security-reference/authorization.md %}#object-ownership) of a database can also execute `ALTER ROLE ALL IN DATABASE ... {SET|RESET}` for that database.
233+
231234
~~~ sql
232235
CREATE DATABASE IF NOT EXISTS movr;
233236
~~~

0 commit comments

Comments
 (0)