Author: paul
Date: 2007-12-04 20:47:19 +0100 (Tue, 04 Dec 2007)
New Revision: 9101
Log:
r27736@frost: paul | 2007-12-04 13:46:35 -0600
CREATE VIEW clarifications. (Bug#30432)
Modified:
trunk/refman-5.0/views.xml
trunk/refman-5.1/views.xml
trunk/refman-6.0/views.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:33765
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:27734
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:22582
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:33765
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:27736
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:22582
Modified: trunk/refman-5.0/views.xml
===================================================================
--- trunk/refman-5.0/views.xml 2007-12-04 17:05:27 UTC (rev 9100)
+++ trunk/refman-5.0/views.xml 2007-12-04 19:47:19 UTC (rev 9101)
Changed blocks: 7, Lines Added: 61, Lines Deleted: 52; 8245 bytes
@@ -156,24 +156,36 @@
<remark role="help-description-begin"/>
<para>
- This statement creates a new view, or replaces an existing one if
- the <literal>OR REPLACE</literal> clause is given. If the view
- does not exist, <literal>CREATE OR REPLACE VIEW</literal> is the
- same as <literal>CREATE VIEW</literal>. If the view does exist,
- <literal>CREATE OR REPLACE VIEW</literal> is the same as
+ The <literal>CREATE VIEW</literal> statement creates a new view,
+ or replaces an existing one if the <literal>OR REPLACE</literal>
+ clause is given. This statement was added in MySQL 5.0.1. If the
+ view does not exist, <literal>CREATE OR REPLACE VIEW</literal> is
+ the same as <literal>CREATE VIEW</literal>. If the view does
+ exist, <literal>CREATE OR REPLACE VIEW</literal> is the same as
<literal>ALTER VIEW</literal>. The
<replaceable>select_statement</replaceable> is a
<literal>SELECT</literal> statement that provides the definition
- of the view. The statement can select from base tables or other
- views.
+ of the view. (When you select from the view, you select in effect
+ using the <literal>SELECT</literal> statement.)
+ <replaceable>select_statement</replaceable> can select from base
+ tables or other views.
</para>
<para>
- This statement requires the <literal>CREATE VIEW</literal>
- privilege for the view, and some privilege for each column
- selected by the <literal>SELECT</literal> statement. For columns
- used elsewhere in the <literal>SELECT</literal> statement you must
- have the <literal>SELECT</literal> privilege. If the <literal>OR
+ The <literal>DEFINER</literal> and <literal>SQL SECURITY</literal>
+ clauses specify the security context to be used when checking
+ access privileges at view invocation time. The
+ <literal>ALGORITHM</literal> clause affects how MySQL processes
+ the view. These clauses are described later in this section.
+ </para>
+
+ <para>
+ The <literal>CREATE VIEW</literal> statement requires the
+ <literal>CREATE VIEW</literal> privilege for the view, and some
+ privilege for each column selected by the
+ <literal>SELECT</literal> statement. For columns used elsewhere in
+ the <literal>SELECT</literal> statement you must have the
+ <literal>SELECT</literal> privilege. If the <literal>OR
REPLACE</literal> clause is present, you must also have the
<literal>DROP</literal> privilege for the view.
</para>
@@ -377,25 +389,13 @@
</para>
<para>
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ The default <literal>DEFINER</literal> value is the user who
+ executes the <literal>CREATE VIEW</literal> statement. This is the
+ same as specifying <literal>DEFINER = CURRENT_USER</literal>
+ explicitly.
+ (<function role="sql" condition="function_current-user">CURRENT_USER</function>
also can be given as
- <function role="sql">CURRENT_USER()</function>.
- </para>
-
- <para>
- Within a stored routine that is defined with the <literal>SQL
- SECURITY DEFINER</literal> characteristic,
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
- returns the routine creator. This also affects a view defined
- within such a routine, if the view definition contains a
- <literal>DEFINER</literal> value of
- <function role="sql" condition="function_current-user">CURRENT_USER</function>.
- </para>
-
- <para>
- The default <literal>DEFINER</literal> value is the user who
- executes the <literal>CREATE VIEW</literal> statement. (This is
- the same as <literal>DEFINER = CURRENT_USER</literal>.) If a
+ <function role="sql">CURRENT_USER()</function>.) If a
<replaceable>user</replaceable> value is given, it should be a
MySQL account in
<literal>'<replaceable>user_name</replaceable>'@'<replaceable>host_name</replaceable>'</literal>
@@ -434,13 +434,26 @@
</itemizedlist>
<para>
+ Within a stored routine that is defined with the <literal>SQL
+ SECURITY DEFINER</literal> characteristic,
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ returns the routine creator. This also affects a view defined
+ within such a routine, if the view definition contains a
+ <literal>DEFINER</literal> value of
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>.
+ </para>
+
+ <para>
The <literal>SQL SECURITY</literal> characteristic determines
which MySQL account to use when checking access privileges for the
- view when the view is executed. The legal characteristic values
- are <literal>DEFINER</literal> and <literal>INVOKER</literal>.
- These indicate that the view must be executable by the user who
- defined it or invoked it, respectively. The default <literal>SQL
- SECURITY</literal> value is <literal>DEFINER</literal>.
+ view when a statement is executed that references the view. The
+ legal characteristic values are <literal>DEFINER</literal> and
+ <literal>INVOKER</literal>. These indicate that the required
+ privileges must be held by the user who defined or invoked it,
+ respectively. The default <literal>SQL SECURITY</literal> value is
+ <literal>DEFINER</literal>. If the value is
+ <literal>DEFINER</literal> but the definer account does not exist
+ when the view is referenced, an error occurs.
</para>
<para>
@@ -528,10 +541,10 @@
<literal>f()</literal> executes. This might mean that privileges
are needed for <literal>p1()</literal> or <literal>p2()</literal>,
depending on the execution path within <literal>f()</literal>.
- Those privileges need to be checked at runtime, and the user who
- must possess the privileges is determined by the <literal>SQL
- SECURITY</literal> values of the function <literal>f()</literal>
- and the view <literal>v</literal>.
+ Those privileges must be checked at runtime, and the user who must
+ possess the privileges is determined by the <literal>SQL
+ SECURITY</literal> values of the view <literal>v</literal> and the
+ function <literal>f()</literal>.
</para>
<para>
@@ -553,12 +566,12 @@
<para>
The optional <literal>ALGORITHM</literal> clause is a MySQL
- extension to standard SQL. <literal>ALGORITHM</literal> takes
- three values: <literal>MERGE</literal>,
- <literal>TEMPTABLE</literal>, or <literal>UNDEFINED</literal>. The
- default algorithm is <literal>UNDEFINED</literal> if no
- <literal>ALGORITHM</literal> clause is present. The algorithm
- affects how MySQL processes the view.
+ extension to standard SQL. It affects how MySQL processes the
+ view. <literal>ALGORITHM</literal> takes three values:
+ <literal>MERGE</literal>, <literal>TEMPTABLE</literal>, or
+ <literal>UNDEFINED</literal>. The default algorithm is
+ <literal>UNDEFINED</literal> if no <literal>ALGORITHM</literal>
+ clause is present.
</para>
<para>
@@ -981,7 +994,9 @@
The <literal>WITH CHECK OPTION</literal> clause can be given for
an updatable view to prevent inserts or updates to rows except
those for which the <literal>WHERE</literal> clause in the
- <replaceable>select_statement</replaceable> is true.
+ <replaceable>select_statement</replaceable> is true. The
+ <literal>WITH CHECK OPTION</literal> clause was implemented in
+ MySQL 5.0.2.
</para>
<remark role="help-description-end"/>
@@ -1048,12 +1063,6 @@
<xref linkend="server-system-variables"/>.
</para>
- <para>
- The <literal>CREATE VIEW</literal> statement was added in MySQL
- 5.0.1. The <literal>WITH CHECK OPTION</literal> clause was
- implemented in MySQL 5.0.2.
- </para>
-
</section>
<section id="drop-view">
Modified: trunk/refman-5.1/views.xml
===================================================================
--- trunk/refman-5.1/views.xml 2007-12-04 17:05:27 UTC (rev 9100)
+++ trunk/refman-5.1/views.xml 2007-12-04 19:47:19 UTC (rev 9101)
Changed blocks: 5, Lines Added: 52, Lines Deleted: 40; 6615 bytes
@@ -156,16 +156,27 @@
<literal>ALTER VIEW</literal>. The
<replaceable>select_statement</replaceable> is a
<literal>SELECT</literal> statement that provides the definition
- of the view. The statement can select from base tables or other
- views.
+ of the view. (When you select from the view, you select in effect
+ using the <literal>SELECT</literal> statement.)
+ <replaceable>select_statement</replaceable> can select from base
+ tables or other views.
</para>
<para>
- This statement requires the <literal>CREATE VIEW</literal>
- privilege for the view, and some privilege for each column
- selected by the <literal>SELECT</literal> statement. For columns
- used elsewhere in the <literal>SELECT</literal> statement you must
- have the <literal>SELECT</literal> privilege. If the <literal>OR
+ The <literal>DEFINER</literal> and <literal>SQL SECURITY</literal>
+ clauses specify the security context to be used when checking
+ access privileges at view invocation time. The
+ <literal>ALGORITHM</literal> clause affects how MySQL processes
+ the view. These clauses are described later in this section.
+ </para>
+
+ <para>
+ The <literal>CREATE VIEW</literal> statement requires the
+ <literal>CREATE VIEW</literal> privilege for the view, and some
+ privilege for each column selected by the
+ <literal>SELECT</literal> statement. For columns used elsewhere in
+ the <literal>SELECT</literal> statement you must have the
+ <literal>SELECT</literal> privilege. If the <literal>OR
REPLACE</literal> clause is present, you must also have the
<literal>DROP</literal> privilege for the view.
</para>
@@ -369,25 +380,13 @@
</para>
<para>
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ The default <literal>DEFINER</literal> value is the user who
+ executes the <literal>CREATE VIEW</literal> statement. This is the
+ same as specifying <literal>DEFINER = CURRENT_USER</literal>
+ explicitly.
+ (<function role="sql" condition="function_current-user">CURRENT_USER</function>
also can be given as
- <function role="sql">CURRENT_USER()</function>.
- </para>
-
- <para>
- Within a stored routine that is defined with the <literal>SQL
- SECURITY DEFINER</literal> characteristic,
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
- returns the routine creator. This also affects a view defined
- within such a routine, if the view definition contains a
- <literal>DEFINER</literal> value of
- <function role="sql" condition="function_current-user">CURRENT_USER</function>.
- </para>
-
- <para>
- The default <literal>DEFINER</literal> value is the user who
- executes the <literal>CREATE VIEW</literal> statement. (This is
- the same as <literal>DEFINER = CURRENT_USER</literal>.) If a
+ <function role="sql">CURRENT_USER()</function>.) If a
<replaceable>user</replaceable> value is given, it should be a
MySQL account in
<literal>'<replaceable>user_name</replaceable>'@'<replaceable>host_name</replaceable>'</literal>
@@ -426,13 +425,26 @@
</itemizedlist>
<para>
+ Within a stored routine that is defined with the <literal>SQL
+ SECURITY DEFINER</literal> characteristic,
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ returns the routine creator. This also affects a view defined
+ within such a routine, if the view definition contains a
+ <literal>DEFINER</literal> value of
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>.
+ </para>
+
+ <para>
The <literal>SQL SECURITY</literal> characteristic determines
which MySQL account to use when checking access privileges for the
- view when the view is executed. The legal characteristic values
- are <literal>DEFINER</literal> and <literal>INVOKER</literal>.
- These indicate that the view must be executable by the user who
- defined it or invoked it, respectively. The default <literal>SQL
- SECURITY</literal> value is <literal>DEFINER</literal>.
+ view when a statement is executed that references the view. The
+ legal characteristic values are <literal>DEFINER</literal> and
+ <literal>INVOKER</literal>. These indicate that the required
+ privileges must be held by the user who defined or invoked it,
+ respectively. The default <literal>SQL SECURITY</literal> value is
+ <literal>DEFINER</literal>. If the value is
+ <literal>DEFINER</literal> but the definer account does not exist
+ when the view is referenced, an error occurs.
</para>
<para>
@@ -520,10 +532,10 @@
<literal>f()</literal> executes. This might mean that privileges
are needed for <literal>p1()</literal> or <literal>p2()</literal>,
depending on the execution path within <literal>f()</literal>.
- Those privileges need to be checked at runtime, and the user who
- must possess the privileges is determined by the <literal>SQL
- SECURITY</literal> values of the function <literal>f()</literal>
- and the view <literal>v</literal>.
+ Those privileges must be checked at runtime, and the user who must
+ possess the privileges is determined by the <literal>SQL
+ SECURITY</literal> values of the view <literal>v</literal> and the
+ function <literal>f()</literal>.
</para>
<para>
@@ -545,12 +557,12 @@
<para>
The optional <literal>ALGORITHM</literal> clause is a MySQL
- extension to standard SQL. <literal>ALGORITHM</literal> takes
- three values: <literal>MERGE</literal>,
- <literal>TEMPTABLE</literal>, or <literal>UNDEFINED</literal>. The
- default algorithm is <literal>UNDEFINED</literal> if no
- <literal>ALGORITHM</literal> clause is present. The algorithm
- affects how MySQL processes the view.
+ extension to standard SQL. It affects how MySQL processes the
+ view. <literal>ALGORITHM</literal> takes three values:
+ <literal>MERGE</literal>, <literal>TEMPTABLE</literal>, or
+ <literal>UNDEFINED</literal>. The default algorithm is
+ <literal>UNDEFINED</literal> if no <literal>ALGORITHM</literal>
+ clause is present.
</para>
<para>
Modified: trunk/refman-6.0/views.xml
===================================================================
--- trunk/refman-6.0/views.xml 2007-12-04 17:05:27 UTC (rev 9100)
+++ trunk/refman-6.0/views.xml 2007-12-04 19:47:19 UTC (rev 9101)
Changed blocks: 5, Lines Added: 52, Lines Deleted: 40; 6615 bytes
@@ -156,16 +156,27 @@
<literal>ALTER VIEW</literal>. The
<replaceable>select_statement</replaceable> is a
<literal>SELECT</literal> statement that provides the definition
- of the view. The statement can select from base tables or other
- views.
+ of the view. (When you select from the view, you select in effect
+ using the <literal>SELECT</literal> statement.)
+ <replaceable>select_statement</replaceable> can select from base
+ tables or other views.
</para>
<para>
- This statement requires the <literal>CREATE VIEW</literal>
- privilege for the view, and some privilege for each column
- selected by the <literal>SELECT</literal> statement. For columns
- used elsewhere in the <literal>SELECT</literal> statement you must
- have the <literal>SELECT</literal> privilege. If the <literal>OR
+ The <literal>DEFINER</literal> and <literal>SQL SECURITY</literal>
+ clauses specify the security context to be used when checking
+ access privileges at view invocation time. The
+ <literal>ALGORITHM</literal> clause affects how MySQL processes
+ the view. These clauses are described later in this section.
+ </para>
+
+ <para>
+ The <literal>CREATE VIEW</literal> statement requires the
+ <literal>CREATE VIEW</literal> privilege for the view, and some
+ privilege for each column selected by the
+ <literal>SELECT</literal> statement. For columns used elsewhere in
+ the <literal>SELECT</literal> statement you must have the
+ <literal>SELECT</literal> privilege. If the <literal>OR
REPLACE</literal> clause is present, you must also have the
<literal>DROP</literal> privilege for the view.
</para>
@@ -368,25 +379,13 @@
</para>
<para>
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ The default <literal>DEFINER</literal> value is the user who
+ executes the <literal>CREATE VIEW</literal> statement. This is the
+ same as specifying <literal>DEFINER = CURRENT_USER</literal>
+ explicitly.
+ (<function role="sql" condition="function_current-user">CURRENT_USER</function>
also can be given as
- <function role="sql">CURRENT_USER()</function>.
- </para>
-
- <para>
- Within a stored routine that is defined with the <literal>SQL
- SECURITY DEFINER</literal> characteristic,
- <function role="sql" condition="function_current-user">CURRENT_USER</function>
- returns the routine creator. This also affects a view defined
- within such a routine, if the view definition contains a
- <literal>DEFINER</literal> value of
- <function role="sql" condition="function_current-user">CURRENT_USER</function>.
- </para>
-
- <para>
- The default <literal>DEFINER</literal> value is the user who
- executes the <literal>CREATE VIEW</literal> statement. (This is
- the same as <literal>DEFINER = CURRENT_USER</literal>.) If a
+ <function role="sql">CURRENT_USER()</function>.) If a
<replaceable>user</replaceable> value is given, it should be a
MySQL account in
<literal>'<replaceable>user_name</replaceable>'@'<replaceable>host_name</replaceable>'</literal>
@@ -425,13 +424,26 @@
</itemizedlist>
<para>
+ Within a stored routine that is defined with the <literal>SQL
+ SECURITY DEFINER</literal> characteristic,
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>
+ returns the routine creator. This also affects a view defined
+ within such a routine, if the view definition contains a
+ <literal>DEFINER</literal> value of
+ <function role="sql" condition="function_current-user">CURRENT_USER</function>.
+ </para>
+
+ <para>
The <literal>SQL SECURITY</literal> characteristic determines
which MySQL account to use when checking access privileges for the
- view when the view is executed. The legal characteristic values
- are <literal>DEFINER</literal> and <literal>INVOKER</literal>.
- These indicate that the view must be executable by the user who
- defined it or invoked it, respectively. The default <literal>SQL
- SECURITY</literal> value is <literal>DEFINER</literal>.
+ view when a statement is executed that references the view. The
+ legal characteristic values are <literal>DEFINER</literal> and
+ <literal>INVOKER</literal>. These indicate that the required
+ privileges must be held by the user who defined or invoked it,
+ respectively. The default <literal>SQL SECURITY</literal> value is
+ <literal>DEFINER</literal>. If the value is
+ <literal>DEFINER</literal> but the definer account does not exist
+ when the view is referenced, an error occurs.
</para>
<para>
@@ -510,10 +522,10 @@
<literal>f()</literal> executes. This might mean that privileges
are needed for <literal>p1()</literal> or <literal>p2()</literal>,
depending on the execution path within <literal>f()</literal>.
- Those privileges need to be checked at runtime, and the user who
- must possess the privileges is determined by the <literal>SQL
- SECURITY</literal> values of the function <literal>f()</literal>
- and the view <literal>v</literal>.
+ Those privileges must be checked at runtime, and the user who must
+ possess the privileges is determined by the <literal>SQL
+ SECURITY</literal> values of the view <literal>v</literal> and the
+ function <literal>f()</literal>.
</para>
<para>
@@ -536,12 +548,12 @@
<para>
The optional <literal>ALGORITHM</literal> clause is a MySQL
- extension to standard SQL. <literal>ALGORITHM</literal> takes
- three values: <literal>MERGE</literal>,
- <literal>TEMPTABLE</literal>, or <literal>UNDEFINED</literal>. The
- default algorithm is <literal>UNDEFINED</literal> if no
- <literal>ALGORITHM</literal> clause is present. The algorithm
- affects how MySQL processes the view.
+ extension to standard SQL. It affects how MySQL processes the
+ view. <literal>ALGORITHM</literal> takes three values:
+ <literal>MERGE</literal>, <literal>TEMPTABLE</literal>, or
+ <literal>UNDEFINED</literal>. The default algorithm is
+ <literal>UNDEFINED</literal> if no <literal>ALGORITHM</literal>
+ clause is present.
</para>
<para>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r9101 - in trunk: . refman-5.0 refman-5.1 refman-6.0 | paul | 4 Dec |