WITH CHECK OPTION  testing is standard-compliant: 

•With LOCAL , the view WHERE  clause is checked, then checking recurses to underlying views and applies the same rules. 

•With CASCADED , the view WHERE  clause is checked, then checking recurses to underlying views, adds WITH CASCADED CHECK OPTION  to them (for purposes of the check; their definitions remain unchanged), and applies the same rules. 

•With no check option, the view WHERE  clause is not checked, then checking recurses to underlying views, and applies the same rules. 

Consider the definitions for the following table and set of views: 

CREATE TABLE t1 (a INT); CREATE VIEW v1 AS SELECT * FROM t1 WHERE a < 2 WITH CHECK OPTION; CREATE VIEW v2 AS SELECT * FROM v1 WHERE a > 0 WITH LOCAL CHECK OPTION; CREATE VIEW v3 AS SELECT * FROM v1 WHERE a > 0 WITH CASCADED CHECK OPTION; 

Here the v2  and v3  views are defined in terms of another view, v1 . 

Inserts for v2  are checked against its LOCAL  check option, then the check recurses to v1  and the rules are applied again. The rules for v1  cause a check failure. The check for v3  also fails: 

## 25.5.5 View Metadata 

mysql> INSERT INTO v2 VALUES (2); ERROR 1369 (HY000): CHECK OPTION failed ’test.v2’ mysql> INSERT INTO v3 VALUES (2); ERROR 1369 (HY000): CHECK OPTION failed ’test.v3’ 

To obtain metadata about views: 

•Query the VIEWS  table of the INFORMATION_SCHEMA  database. See Section 26.3.48, “The INFORMATION_SCHEMA VIEWS Table” . 

•Use the SHOW CREATE VIEW  statement. See Section 13.7.7.13, “SHOW CREATE VIEW Statement” . 

## 25.6 Stored Object Access Control 

Stored programs (procedures, functions, triggers, and events) and views are defined prior to use and, when referenced, execute within a security context that determines their privileges. The privileges applicable to execution of a stored object are controlled by its DEFINER  attribute and SQL SECURITY characteristic. 

•The DEFINER Attribute 

•The SQL SECURITY Characteristic 

•Examples 

•Orphan Stored Objects 

•Risk-Minimization Guidelines 

