View¶
Defines a view
Properties¶
| Property | Type | Required | Description |
|---|---|---|---|
schema |
string |
— | The schema the view is created in. |
name |
string |
— | The view name. |
owner |
string |
— | The role that owns the view. |
sql |
string |
— | User-provided raw SQL snippet. |
recursive |
boolean |
— | Specifies the view is a recursive view. |
columns |
array of (string | object) |
— | An optional list of names to be used for columns of the view. If not given, the column names are deduced from the query. |
check_option |
LOCAL | CASCADED |
— | This option controls the behavior of automatically updatable views. When this option is specified, INSERT and UPDATE commands on the view will be checked to ensure that new rows satisfy the view-defining condition (that is, the new rows are checked to ensure that they are visible through the view). If they are not, the update will be rejected. If the CHECK OPTION is not specified, INSERT and UPDATE commands on the view are allowed to create rows that are not visible through the view. When it is set to LOCAL, new rows are only checked against the conditions defined directly in the view itself. Any conditions defined on underlying base views are not checked (unless they also specify the CHECK OPTION). When it is set to CASCADED, new rows are checked against the conditions of the view and all underlying base views. If the CHECK OPTION is specified, and neither LOCAL nor CASCADED is specified, then CASCADED is assumed. |
security_barrier |
boolean |
— | This should be used if the view is intended to provide row-level security. |
query |
string |
— | A SELECT or VALUES command which will provide the columns and rows of the view. |
rules |
array of rule | — | An array of rewrite rules on the view. |
comment |
string |
— | An optional comment about the view. |
dependencies |
dependencies | — | Database objects this object is dependent upon. |
Mutually exclusive forms¶
Exactly one of these must hold:
query, withoutsqlsql, withoutrecursiveorcolumnsorcheck_optionorsecurity_barrierorquery
No other properties are accepted.
Source: schemata/view.yml · Resolved JSON Schema: view.json