Note that the CHECK OPTION is only supported on views that are automatically updatable, and do not have INSTEAD OF triggers or INSTEAD rules. The CHECK OPTION may not be used with RECURSIVE views. If the CHECK OPTION is specified, and neither LOCAL nor CASCADED is specified, then CASCADED is assumed. New rows are checked against the conditions of the view and all underlying base views. Any conditions defined on underlying base views are not checked (unless they also specify the CHECK OPTION). ![]() New rows are only checked against the conditions defined directly in the view itself. The following check options are supported: 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. If they are not, the update will be rejected. 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). This option controls the behavior of automatically updatable views. queryĪ SELECT or VALUES command which will provide the columns and rows of the view. See the notes below for full details.Īll of the above options can be changed on existing views using ALTER VIEW. This option causes the underlying base relations to be checked against the privileges of the user of the view rather than the view owner. This should be used if the view is intended to provide row-level security. This parameter may be either local or cascaded, and is equivalent to specifying WITH CHECK OPTION (see below). This clause specifies optional parameters for a view the following parameters are supported: If not given, the column names are deduced from the query. column_nameĪn optional list of names to be used for columns of the view. The name (optionally schema-qualified) of a view to be created. ) SELECT column_names FROM view_name Ī view column name list must be specified for a recursive view. ĬREATE VIEW view_name AS WITH RECURSIVE view_name ( column_names) AS (SELECT. RECURSIVEĬREATE RECURSIVE VIEW view_name ( column_names) AS SELECT. If any of the tables referenced by the view are temporary, the view is created as a temporary view (whether TEMPORARY is specified or not). ![]() Existing permanent relations with the same name are not visible to the current session while the temporary view exists, unless they are referenced with schema-qualified names. Temporary views are automatically dropped at the end of the current session. If specified, the view is created as a temporary view. The name of the view must be distinct from the name of any other relation (table, sequence, index, view, materialized view, or foreign table) in the same schema. Temporary views exist in a special schema, so a schema name cannot be given when creating a temporary view. Otherwise it is created in the current schema. ) then the view is created in the specified schema. If a schema name is given (for example, CREATE VIEW myschema.myview. The calculations giving rise to the output columns may be completely different. The new query must generate the same columns that were generated by the existing view query (that is, the same column names in the same order and with the same data types), but it may add additional columns to the end of the list. Instead, the query is run every time the view is referenced in a query.ĬREATE OR REPLACE VIEW is similar, but if a view of the same name already exists, it is replaced.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |