Below is the list of changes that have just been committed into a local
mysqldoc repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2517 04/12/21 10:21:02 paul@stripped +1 -0
manual.texi:
Add some views information.
Docs/manual.texi
1.2280 04/12/21 10:20:48 paul@stripped +70 -13
Add some views information.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: paul
# Host: frost.snake.net
# Root: /Volumes/frost2/MySQL/bk/mysqldoc
--- 1.2279/Docs/manual.texi 2004-12-21 09:25:49 -06:00
+++ 1.2280/Docs/manual.texi 2004-12-21 10:20:48 -06:00
@@ -57381,8 +57381,67 @@
This statement creates a new view, or replaces an existing one if the
@code{OR REPLACE} clause is given. The @var{select_statement} is a
@code{SELECT} statement that provides the definition of the view.
-The optional column list can be given to define explicit names for the
-view columns.
+The statement can select from base tables or other views.
+
+A view belongs to a database. By default, a new view is created in the
+current database. To create the view explicitly in a given database,
+specify the name as @var{db_name.view_name} when you create it.
+
+@example
+mysql> CREATE VIEW test.v AS SELECT * FROM t;
+@end example
+
+Tables and views share the same namespace within a database, so a database
+cannot contain a table and a view that have the same name.
+
+Views must have unique column names with no duplicates, just like base
+tables. By default, the names of the columns retrieved by the @code{SELECT}
+statement are used for the view column names. To define explicit names for
+the view columns, the optional column list can be given. In this case, the
+number of names in @var{column_list} must be the same as the number of
+columns retrieved by the @code{SELECT} statement.
+
+Columns retrieved by the @code{SELECT} statement can be simple references to
+table columns. They can also be expressions that use operators, functions,
+constant values, and so forth.
+
+@c TODO: however, use of anything othe than simple column references
+@c makes view not updatable. Updatable views must select only table columns.
+
+A view can refer to columns of tables or views in other databases by
+qualifying the table or view name with the proper database name.
+
+A view definition is subject to the following constraints:
+
+@itemize @bullet
+
+@item
+The @code{SELECT} statement cannot contain a subquery in the @code{FROM}
+clause.
+
+@item
+The @code{SELECT} statement cannot refer to user variables.
+
+@item
+Within a stored procedure, the definition cannot refer to procedure
+parameters.
+
+@item
+Any table or view referred to in the definition must exist. However, after
+a view has been created, it is possible to drop a table or view that the
+definition refers to.
+@c TODO: add the following when CHECK VIEW gets pushed
+@c To check a view definition for problems of this kind, use the
+@c @code{CHECK VIEW} statement.
+
+@item
+The definition cannot refer to a @code{TEMPORARY} table, and you cannot
+create a @code{TEMPORARY} view.
+
+@item
+You cannot associate a trigger with a view.
+
+@end itemize
@c TODO: need to describe ALGORITHM clause
@@ -57410,14 +57469,6 @@
+------+-------+-------+
@end example
-By default, the view is in the current database. To create
-the view explicitly in a given database, specify the name as
-@var{db_name.view_name} when you create it.
-
-@example
-mysql> CREATE VIEW test.v AS SELECT * FROM t;
-@end example
-
In a @code{WITH CHECK OPTION} clause for an updatable view, the @code{LOCAL}
and @code{CASCADED} keywords determine the scope of check testing when the
view is defined in terms of another view. @code{LOCAL} keyword restricts
@@ -60540,9 +60591,11 @@
SHOW TABLE STATUS [FROM @var{db_name}] [LIKE '@var{pattern}']
@end example
-@code{SHOW TABLE STATUS} (new in MySQL 3.23) works likes @code{SHOW
-TABLE}, but provides a lot of information about each table. You can
-also get this list using the @command{mysqlshow --status @var{db_name}} command.
+@code{SHOW TABLE STATUS} works likes @code{SHOW TABLE}, but provides a lot
+of information about each table. You can also get this list using the
+@command{mysqlshow --status @var{db_name}} command. This statement was
+added in MySQL 3.23. As of MySQL 5.0.1, it also displays information about
+views.
@code{SHOW TABLE STATUS} returns the following fields:
@@ -60630,6 +60683,10 @@
@code{Max_data_length}, and @code{Index_length} values approximate the
actual amount of allocated memory. The allocation algorithm reserves memory
in large amounts to reduce the number of allocation operations.
+
+For views, all the fields displayed by @code{SHOW TABLE STATUS} are
+@code{NULL} except that @code{Name} indicates the view name and @code{Comment}
+says @code{view}.
@node SHOW TABLES, SHOW VARIABLES, SHOW TABLE STATUS, SHOW
| Thread |
|---|
| • bk commit - mysqldoc tree (paul:1.2517) | paul | 21 Dec |