summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-06-15 16:27:41 -0700
committerunknown <jimw@mysql.com>2005-06-15 16:27:41 -0700
commited483fcd21349e0ac5daf77658446ae0da37bef8 (patch)
treeeebeb8eaf737d3507934ff5be9d1b1c7b72c8f10 /sql/sql_show.cc
parentfc465d1497ce598d07ec75eeaafc7ca84b578ee6 (diff)
downloadmariadb-git-ed483fcd21349e0ac5daf77658446ae0da37bef8.tar.gz
Fix SHOW CREATE VIEW to handle ANSI_QUOTES mode. (Bug #6903)
mysql-test/r/sql_mode.result: Update results mysql-test/r/view.result: Update results mysql-test/t/sql_mode.test: Add new regression tests sql/sql_show.cc: Fix SHOW CREATE VIEW to honor ANSI_QUOTES mode.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 68c6d1a8030..2b433981579 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -347,6 +347,9 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->table_name));
+ /* We want to preserve the tree for views. */
+ thd->lex->view_prepare_mode= TRUE;
+
/* Only one table for now, but VIEW can involve several tables */
if (open_normal_and_derived_tables(thd, table_list))
{
@@ -1061,7 +1064,13 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
buff->append('.');
append_identifier(thd, buff, table->view_name.str, table->view_name.length);
buff->append(" AS ", 4);
- buff->append(table->query.str, table->query.length);
+
+ /*
+ We can't just use table->query, because our SQL_MODE may trigger
+ a different syntax, like when ANSI_QUOTES is defined.
+ */
+ table->view->unit.print(buff);
+
if (table->with_check != VIEW_CHECK_NONE)
{
if (table->with_check == VIEW_CHECK_LOCAL)