Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with views

Enabling and disabling views Next Page

View dependencies


A view definition can refer to other objects including columns, tables, and other views. When a view makes a reference to another object, the view is called a referencing object and the object to which it refers is called a referenced object. Further, a referencing object can be considered dependent on the objects to which it refers.

The set of referenced objects for a given view includes all of the objects to which it refers, either directly or indirectly. For example, a view can refer to another view, which may itself refer to other views and tables.

Consider the following set of tables and views:

CREATE TABLE t1 ( c1 INT, c2 INT );
CREATE TABLE t2( c3 INT, c4 INT );
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT c3 FROM t2;
CREATE VIEW v3 AS SELECT c1, c3 FROM v1, v2;

The following view dependencies can be determined from the definitions above:

The database server keeps track of columns, tables, and views referenced by any given view. The database server uses this dependency information to ensure that schema changes to referenced objects do not leave a referencing view in an invalid state. In the case of non-materialized views, the database server provides this guarantee by automatically recompiling all referencing views whenever schema changes are made to referenced objects. In the case of materialized views, schema changes to a referenced object are not permitted if the object has any enabled materialized views.

Following is a list of considerations for view dependencies:


View status
Dependencies and schema-altering changes
View dependency information in the catalog