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 » View dependencies

View status Next Page

Dependencies and schema-altering changes


An attempt to alter the schema defined for a table or view requires that the database server consider if there are dependent views impacted by the change. Examples of schema-altering operations include:

When you attempt a schema-altering operation, the following events occur:

  1. The database server generates a list of views that depend directly or indirectly upon the table or view being altered. Views with a DISABLED status are ignored.

    If any of the dependent views are materialized views, the request fails, an error is returned, and the remaining events do not occur. You must first disable dependent materialized views before proceeding with the operation. See Enabling and disabling materialized views.

  2. The database server obtains exclusive schema locks on the table or view being modified, as well as on all dependent views.

  3. The database server sets the status of all dependent views to INVALID.

  4. The database server performs the schema-altering operation. If the operation fails, the locks are released, the status of dependent views is reset to VALID, an error is returned, and the following step does not occur.

  5. The database server recompiles the dependent views, setting each view's status to VALID when successful. If compilation fails for any view, the status of that view remains INVALID. Subsequent requests for an INVALID view causes the database server to attempt to recompile the view. If subsequent attempts fail, it is likely that an alteration is required on the INVALID view, or on an object upon which it depends, for it to compile successfully.