You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/current/v26.2/alter-view.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ toc: true
5
5
docs_area: reference.sql
6
6
---
7
7
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 %}).
9
9
10
10
{% include {{ page.version.version }}/misc/schema-change-stmt-note.md %}
11
11
@@ -31,7 +31,7 @@ Parameter | Description
31
31
`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.
32
32
`schema_name` | The name of the new schema.
33
33
`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.
35
35
36
36
## Known limitations
37
37
@@ -138,7 +138,7 @@ SHOW CREATE cockroach_labs.expensive_rides;
138
138
139
139
### Set or reset `security_invoker`
140
140
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):
Copy file name to clipboardExpand all lines: src/current/v26.2/create-view.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ toc: true
5
5
docs_area: reference.sql
6
6
---
7
7
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.
9
9
10
10
{{site.data.alerts.callout_info}}
11
11
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
32
32
`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.
33
33
`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`.
34
34
`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.
36
36
`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.
37
37
`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 %}).
38
38
`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
151
151
152
152
### Create a view with invoker privileges
153
153
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):
0 commit comments