Bug #32097 Term "statement" used wrongly
Submitted: 5 Nov 2007 8:40 Modified: 5 Nov 2007 18:37
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[5 Nov 2007 8:40] Roland Bouman
Description:
In 

http://dev.mysql.com/doc/refman/5.1/en/manual-conventions.html

the following text appears:

"For example, INSERT ... SELECT is shorthand for the form of INSERT statement that is followed by a SELECT statement."

This wording does not reflect what a statement is. A statement is a syntactical unit as it is recognized by the parser. As such, the entire phrase:

INSERT ... SELECT

is recognized as a statement. 

Pure SQL statements cannot contain other statements. It may be possible that a fragment of a statement may be parsed itself as a statement if it would have appeared in isolation (this is the case here for the SELECT given in the example). However, that does not make that fragment a statement - at least, not in the context where it appears as part of a statement. 

The definitions from the SQL standard may clarify this:

<insert statement> ::=
INSERT INTO <insertion target> <insert columns and source>

<insertion target> ::= <table name>

<insert columns and source> ::=
<from subquery>
| <from constructor>
| <from default>

<from subquery> ::=
[ <left paren> <insert column list> <right paren> ]
[ <override clause> ]
<query expression>

So, here, the part of the statement introduced by SELECT is denoted as a "query expression" - not as a "SELECT statement".

How to repeat:
http://dev.mysql.com/doc/refman/5.1/en/manual-conventions.html

Suggested fix:
Use the term "query expression" to denote the piece of the statement that starts with "SELECT"
[5 Nov 2007 8:56] Valeriy Kravchuk
Thank you for a reasonable documentation request.
[5 Nov 2007 13:08] Stefan Hinz
Considering that the sentence in question is used to explain the role of the ellipsis in the Manual I'd consider this a minuscule issue. However, I agree that the sentence could be rephrased to use a different example that will not give rise to controversies.
[5 Nov 2007 18:37] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

I changed the example to use "SELECT ... INTO OUTFILE" and referred to the latter part as a "clause".