summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorgshchepa/uchum@host.loc <>2008-03-26 22:43:12 +0400
committergshchepa/uchum@host.loc <>2008-03-26 22:43:12 +0400
commit2dcec449e0c0854b1d3387dc7d55e3b5969baa1a (patch)
treedeb5b8460977e5fed2d967ef82d48dbd7aa9e58d /sql/sql_select.cc
parent1eb00401f4e46b555cdbf906cc468d152be563c2 (diff)
downloadmariadb-git-2dcec449e0c0854b1d3387dc7d55e3b5969baa1a.tar.gz
Fixed bug #35193.
View definition as SELECT ... FROM DUAL WHERE ... has valid syntax, but use of such view in SELECT or SHOW CREATE VIEW syntax causes unexpected syntax error. Server omits FROM DUAL clause when storing view body string in a .frm file for further evaluation. However, syntax of SELECT-witout-FROM query is more restrictive than SELECT FROM DUAL syntax, and doesn't allow the WHERE clause. NOTE: this syntax difference is not documented. View registration procedure has been modified to preserve original structure of view's body.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 6392f7c4299..bb3030a721c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -15806,6 +15806,14 @@ void st_select_lex::print(THD *thd, String *str)
/* go through join tree */
print_join(thd, str, &top_join_list);
}
+ else if (where)
+ {
+ /*
+ "SELECT 1 FROM DUAL WHERE 2" should not be printed as
+ "SELECT 1 WHERE 2": the 1st syntax is valid, but the 2nd is not.
+ */
+ str->append(STRING_WITH_LEN(" from DUAL "));
+ }
// Where
Item *cur_where= where;