Use the View dialog to define a view. The view is not physically materialized; the query is executed each time the view is referenced in a query.
The View dialog organizes the development of a View through the following dialog tabs: General, Definition, and Security”. The SQL tab displays the SQL code generated by dialog selections.
Click the General tab to begin.
Use the fields in the General tab to identify a view:
Click the Definition tab to continue.
Use the fields in the Definition tab to define properties of the view:
Set the Security Barrier switch to Yes to indicate that the view is to act as a security barrier. For more information about defining and using a security barrier rule, see Section 38.5 of the PostgreSQL documentation.
The Local option specifies that new rows are only checked against the conditions defined in the view. Any conditions defined on underlying base views are not checked (unless you specify the CHECK OPTION). The Cascaded option specifies new rows are checked against the conditions of the view and all underlying base views.
Use the workspace in the Definition field to write a query to create a view.
Click the Security tab to continue.
Use the Security tab to assign privileges and define security labels.
Use the Privileges panel to assign privileges to a role. Click the Add icon (+) to set privileges for the view:
Click the Add icon (+) to assign additional privileges; to discard a privilege, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Use the Security Labels panel to define security labels applied to the view. Click the Add icon (+) to add each security label selection:
Click the Add icon (+) to assign additional security labels; to discard a security label, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Click the SQL tab to continue.
Your entries in the View dialog generate a SQL command (see an example below). Use the SQL tab for review; revisit or switch tabs to make any changes to the SQL command.
Example
The following is an example of the sql command generated by user selections in the View dialog:
The example shown demonstrates creating a view named distributor_codes that includes the content of the code column from the distributors table.