Skip to content

Commit c1fa015

Browse files
committed
Update with bsanchez-the-roach feedback
1 parent 5888e28 commit c1fa015

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/current/v26.2/alter-view.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ toc: true
55
docs_area: reference.sql
66
---
77

8-
The `ALTER VIEW` [statement]({% link {{ page.version.version }}/sql-statements.md %}) applies a schema change to a [view]({% link {{ page.version.version }}/views.md %}). You can also use `ALTER VIEW` to set or reset the `security_invoker` option on a non-materialized view.
8+
The `ALTER VIEW` [statement]({% link {{ page.version.version }}/sql-statements.md %}) applies a schema change to a [view]({% link {{ page.version.version }}/views.md %}).
99

1010
{% include {{ page.version.version }}/misc/schema-change-stmt-note.md %}
1111

@@ -31,7 +31,7 @@ Parameter | Description
3131
`view_new_name` | The new name of the view. The name of the view must be unique to its database and follow these [identifier rules]({% link {{ page.version.version }}/keywords-and-identifiers.md %}#identifiers). Name changes do not propagate to the table(s) using the view.
3232
`schema_name` | The name of the new schema.
3333
`role_spec` | The role to set as the owner of the view.
34-
`security_invoker` | Sets whether to check privileges on the underlying tables as the querying user (`true`) or the view owner (`false`). `SET (security_invoker)` is equivalent to `SET (security_invoker = true)`. `RESET (security_invoker)` restores the default behavior. This option applies only to non-materialized views.
34+
`security_invoker` | Sets whether to check privileges on the underlying tables as the querying user (`true`) or the view owner (`false`). `SET (security_invoker)` is equivalent to `SET (security_invoker = true)`. `RESET (security_invoker)` restores the default behavior, where a view checks privileges on the underlying tables as the view owner. This option applies only to non-materialized views.
3535

3636
## Known limitations
3737

@@ -138,7 +138,7 @@ SHOW CREATE cockroach_labs.expensive_rides;
138138

139139
### Set or reset `security_invoker`
140140

141-
By default, a view checks privileges on the underlying tables as the view owner. To change the view to use the querying user's privileges instead:
141+
By default, a view checks privileges on the underlying tables as the view owner. To change the view to use the querying user's privileges instead, include the [`security_invoker` option]({% link {{ page.version.version }}/views.md %}#use-invoker-privileges-for-underlying-data):
142142

143143
{% include_cached copy-clipboard.html %}
144144
~~~ sql

src/current/v26.2/create-view.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ toc: true
55
docs_area: reference.sql
66
---
77

8-
The `CREATE VIEW` statement creates a new [view]({% link {{ page.version.version }}/views.md %}), which is a stored query represented as a virtual table. By default, CockroachDB checks privileges on the underlying tables using the view owner's privileges. To check privileges using the querying user's privileges instead, create the view with `WITH (security_invoker)` or `WITH (security_invoker = true)`.
8+
The `CREATE VIEW` statement creates a new [view]({% link {{ page.version.version }}/views.md %}), which is a stored query represented as a virtual table.
99

1010
{{site.data.alerts.callout_info}}
1111
By default, views created in a database cannot reference objects in a different database. To enable cross-database references for views, set the `sql.cross_db_views.enabled` [cluster setting]({% link {{ page.version.version }}/cluster-settings.md %}) to `true`.
@@ -32,7 +32,7 @@ Parameter | Description
3232
`OR REPLACE` | Create a new view if a view of the same name does not already exist. If a view of the same name already exists, replace that view.<br><br>In order to replace an existing view, the new view must have the same columns as the existing view, or more. If the new view has additional columns, the old columns must be a prefix of the new columns. For example, if the existing view has columns `a, b`, the new view can have an additional column `c`, but must have columns `a, b` as a prefix. In this case, `CREATE OR REPLACE VIEW myview (a, b, c)` would be allowed, but `CREATE OR REPLACE VIEW myview (b, a, c)` would not.
3333
`view_name` | The name of the view to create, which must be unique within its database and follow these [identifier rules]({% link {{ page.version.version }}/keywords-and-identifiers.md %}#identifiers). When the parent database is not set as the default, the name must be formatted as `database.name`.
3434
`name_list` | An optional, comma-separated list of column names for the view. If specified, these names will be used in the response instead of the columns specified in `AS select_stmt`.
35-
`WITH (security_invoker [ = { true | false } ])` | Sets whether to check privileges on the underlying tables as the querying user (`true`) or the view owner (`false`). `WITH (security_invoker)` is equivalent to `WITH (security_invoker = true)`. This option applies only to non-materialized views.
35+
`WITH (security_invoker = true)` | Sets whether to check privileges on the underlying tables as the querying user (`true`) or the view owner (`false`). `WITH (security_invoker)` is equivalent to `WITH (security_invoker = true)`. This option applies only to non-materialized views.
3636
`AS select_stmt` | The [selection query]({% link {{ page.version.version }}/selection-queries.md %}) to execute when the view is requested.<br><br>Note that it is not currently possible to use `*` to select all columns from a referenced table or view; instead, you must specify specific columns.
3737
`AS OF SYSTEM TIME` | When used with `CREATE MATERIALIZED VIEW`, populates the materialized view using historical data. This can reduce [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention) by leveraging [follower reads]({% link {{ page.version.version }}/follower-reads.md %}). The timestamp must be within the [garbage collection window]({% link {{ page.version.version }}/configure-replication-zones.md %}#gc-ttlseconds). For more information, see [`AS OF SYSTEM TIME`]({% link {{ page.version.version }}/as-of-system-time.md %}).
3838
`opt_temp` | Defines the view as a session-scoped temporary view. For more information, see [Temporary Views]({% link {{ page.version.version }}/views.md %}#temporary-views).<br><br>**Support for temporary views is [in preview]({% link {{ page.version.version }}/cockroachdb-feature-availability.md %}#temporary-objects)**.
@@ -151,7 +151,7 @@ Executing the query is as easy as `SELECT`ing from the view, as you would from a
151151

152152
### Create a view with invoker privileges
153153

154-
To make a view check privileges on the underlying tables as the querying user, include the `security_invoker` option:
154+
To make a view check privileges on the underlying tables as the querying user, include the [`security_invoker` option]({% link {{ page.version.version }}/views.md %}#use-invoker-privileges-for-underlying-data):
155155

156156
{% include_cached copy-clipboard.html %}
157157
~~~ sql

0 commit comments

Comments
 (0)