[Pkg-mysql-commits] [mariadb-5.5] 01/03: Imported Upstream version 5.5.47

Otto Kekäläinen ottok-guest at moszumanska.debian.org
Thu Dec 10 10:18:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

ottok-guest pushed a commit to branch ubuntu-14.04
in repository mariadb-5.5.

commit a295acf55a6231f0a52f21b566760c03c6a5ddbf
Author: Otto Kekäläinen <otto at seravo.fi>
Date:   Thu Dec 10 10:13:45 2015 +0200

    Imported Upstream version 5.5.47
---
 Docs/INFO_SRC                                      |   10 +-
 VERSION                                            |    2 +-
 client/mysql_plugin.c                              |   10 +-
 client/mysql_upgrade.c                             |   94 +-
 client/mysqlcheck.c                                |    2 +-
 client/mysqldump.c                                 |   20 +-
 client/mysqlshow.c                                 |   39 +-
 cmake/cpack_rpm.cmake                              |    2 +-
 debian/mariadb-server-5.5.mysql-server.logrotate   |    2 +-
 libmysql/conf_to_src.c                             |    4 +-
 mysql-test/include/default_mysqld.cnf              |    3 +
 mysql-test/r/create.result                         |    6 +
 mysql-test/r/ctype_filename.result                 |    3 +
 mysql-test/r/ctype_utf8.result                     |   27 +
 mysql-test/r/events_1.result                       |    2 +-
 mysql-test/r/fulltext.result                       |    2 +-
 mysql-test/r/mysql_plugin.result                   |    2 +-
 mysql-test/r/mysql_upgrade.result                  |    9 +-
 mysql-test/r/mysqldump.result                      |   26 +
 mysql-test/r/ps.result                             |   21 +
 mysql-test/r/ps_change_master.result               |   22 +
 mysql-test/r/range.result                          |   13 +
 mysql-test/r/range_mrr_icp.result                  |   13 +
 mysql-test/r/show_row_order-9226.result            |   80 +
 mysql-test/r/udf_notembedded.result                |    6 +
 mysql-test/r/update.result                         |   59 +
 mysql-test/r/view.result                           |   33 +
 .../suite/federated/error_on_close-8313.result     |   27 +
 .../suite/federated/error_on_close-8313.test       |   38 +
 mysql-test/suite/innodb/r/dropdb.result            |    9 +
 mysql-test/suite/innodb/r/innodb-autoinc.result    |   16 +-
 .../suite/innodb/r/innodb-fk-warnings.result       |   24 +-
 mysql-test/suite/innodb/r/innodb-fk.result         |    6 +-
 .../r/innodb_information_schema_tables.result      |    2 +
 mysql-test/suite/innodb/t/dropdb.test              |   12 +
 mysql-test/suite/innodb/t/innodb-autoinc.test      |    3 +-
 .../innodb/t/innodb_information_schema_tables.opt  |   29 +
 .../innodb/t/innodb_information_schema_tables.test |   64 +
 .../suite/plugins/r/feedback_plugin_install.result |    3 +-
 .../suite/plugins/r/feedback_plugin_load.result    |    3 +-
 .../suite/plugins/r/feedback_plugin_send.result    |   10 +-
 .../suite/plugins/t/feedback_plugin_install.test   |    4 +-
 .../suite/plugins/t/feedback_plugin_load.test      |    3 +-
 .../suite/plugins/t/feedback_plugin_send.test      |   21 +-
 mysql-test/t/create.test                           |    8 +
 mysql-test/t/ctype_filename.test                   |    3 +
 mysql-test/t/ctype_utf8.test                       |   16 +
 mysql-test/t/events_1.test                         |    2 +-
 mysql-test/t/mysql_upgrade.test                    |    9 +-
 mysql-test/t/mysqldump.test                        |   10 +
 mysql-test/t/ps.test                               |   22 +
 mysql-test/t/ps_change_master.test                 |   45 +
 mysql-test/t/range.test                            |   12 +
 mysql-test/t/show_row_order-9226.test              |   73 +
 mysql-test/t/udf_notembedded.test                  |   14 +
 mysql-test/t/update.test                           |   73 +
 mysql-test/t/view.test                             |   35 +
 mysys/my_getopt.c                                  |    2 +-
 packaging/rpm-oel/mysql.spec.in                    |    7 +-
 plugin/daemon_example/daemon_example.cc            |   12 +-
 plugin/feedback/feedback.cc                        |   33 +
 plugin/feedback/feedback.h                         |    4 +
 plugin/feedback/sender_thread.cc                   |    8 +-
 regex/main.c                                       |   17 +-
 scripts/mysqld_multi.sh                            |   20 +-
 sql-common/client.c                                |   55 +-
 sql/field.h                                        |   20 +-
 sql/item.cc                                        |   23 +-
 sql/item_cmpfunc.cc                                |    2 +-
 sql/item_cmpfunc.h                                 |    4 +-
 sql/item_func.cc                                   |   10 +-
 sql/item_subselect.cc                              |   28 +-
 sql/log.cc                                         |    2 +
 sql/mysqld.cc                                      |   14 +-
 sql/mysqld.h                                       |    4 +-
 sql/sql_acl.cc                                     |    4 +
 sql/sql_insert.cc                                  |   16 +-
 sql/sql_lex.cc                                     |   23 +
 sql/sql_lex.h                                      |    2 +
 sql/sql_prepare.cc                                 |   16 +-
 sql/sql_reload.cc                                  |    5 +-
 sql/sql_select.cc                                  |   38 +-
 sql/sql_show.cc                                    |    5 +-
 sql/sql_table.cc                                   |    5 +-
 sql/sql_udf.cc                                     |    4 +-
 sql/sql_udf.h                                      |    3 +
 sql/sql_update.cc                                  |   32 +-
 sql/sql_update.h                                   |    1 +
 sql/sql_view.cc                                    |    5 +
 sql/sql_yacc.cc                                    | 2437 ++++++++++----------
 sql/sql_yacc.yy                                    |    9 +
 sql/table.cc                                       |   17 +-
 storage/federated/ha_federated.cc                  |   31 +-
 storage/federatedx/ha_federatedx.cc                |   71 +-
 storage/innobase/dict/dict0crea.c                  |    2 +-
 storage/innobase/dict/dict0dict.c                  |  122 +-
 storage/innobase/handler/ha_innodb.cc              |   32 +-
 storage/innobase/log/log0recv.c                    |    8 +-
 storage/myisam/mi_create.c                         |    6 +-
 storage/tokudb/hatoku_cmp.cc                       |  186 --
 storage/tokudb/hatoku_cmp.h                        |   19 -
 storage/tokudb/hatoku_hton.h                       |    8 -
 storage/xtradb/CMakeLists.txt                      |   17 +-
 storage/xtradb/btr/btr0cur.c                       |   47 +-
 storage/xtradb/dict/dict0crea.c                    |    2 +-
 storage/xtradb/dict/dict0dict.c                    |  122 +-
 storage/xtradb/handler/ha_innodb.cc                |  178 +-
 storage/xtradb/handler/i_s.cc                      |   15 +-
 storage/xtradb/include/ha_prototypes.h             |   10 +
 storage/xtradb/include/os0file.h                   |   11 +-
 storage/xtradb/include/os0sync.h                   |  115 +-
 storage/xtradb/include/sync0sync.h                 |    9 +-
 storage/xtradb/include/sync0sync.ic                |    9 +-
 storage/xtradb/include/univ.i                      |    4 +-
 storage/xtradb/lock/lock0lock.c                    |   10 +-
 storage/xtradb/log/log0online.c                    |   16 +-
 storage/xtradb/log/log0recv.c                      |    2 +-
 storage/xtradb/os/os0file.c                        |   17 +-
 storage/xtradb/row/row0ins.c                       |    5 +-
 storage/xtradb/trx/trx0trx.c                       |    6 +
 strings/ctype-utf8.c                               |    2 +-
 support-files/mysql.server.sh                      |    2 +-
 unittest/mysys/CMakeLists.txt                      |    1 +
 unittest/mysys/my_getopt-t.c                       |   71 +
 124 files changed, 3188 insertions(+), 1963 deletions(-)

diff --git a/Docs/INFO_SRC b/Docs/INFO_SRC
index bc3dc61..7092fb8 100644
--- a/Docs/INFO_SRC
+++ b/Docs/INFO_SRC
@@ -1,8 +1,8 @@
-commit: 16c4b3c68b06653592a9500050ad977a38f4ebae
-date: 2015-10-09 16:43:59 +0200
-build-date: 2015-10-09 18:51:17 +0200 
-short: 16c4b3c
+commit: d67aacb4fbb449ffa8db4e3d70fe8756d62b5222
+date: 2015-12-09 17:11:55 +0100
+build-date: 2015-12-09 18:22:49 +0100 
+short: d67aacb
 branch: HEAD
 
 
-MySQL source 5.5.46
+MySQL source 5.5.47
diff --git a/VERSION b/VERSION
index 45f770d..b85da23 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=5
 MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=46
+MYSQL_VERSION_PATCH=47
 MYSQL_VERSION_EXTRA=
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 99da157..bc9969c 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -407,7 +407,7 @@ exit:
 static void usage(void)
 {
   PRINT_VERSION;
-  puts("Copyright (c) 2011, Oracle and/or its affiliates. "
+  puts("Copyright (c) 2011, 2015, Oracle and/or its affiliates. "
        "All rights reserved.\n");
   puts("Enable or disable plugins.");
   printf("\nUsage: %s [options] <plugin> ENABLE|DISABLE\n\nOptions:\n",
@@ -758,6 +758,11 @@ static int check_options(int argc, char **argv, char *operation)
     /* read the plugin config file and check for match against argument */
     else
     {
+      if (strlen(argv[i]) + 4 + 1 > FN_REFLEN)
+      {
+        fprintf(stderr, "ERROR: argument is too long.\n");
+        return 1;
+      }
       strcpy(plugin_name, argv[i]);
       strcpy(config_file, argv[i]);
       strcat(config_file, ".ini");
@@ -849,6 +854,7 @@ static int process_options(int argc, char *argv[], char *operation)
     if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
     {
       char buff[FN_REFLEN];
+      memset(buff, 0, sizeof(buff));
       
       strncpy(buff, opt_basedir, sizeof(buff) - 1);
 #ifdef __WIN__
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index ee6845d..0be8f91 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2006, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2010, 2013, Monty Program Ab.
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -53,6 +53,8 @@ static DYNAMIC_STRING conn_args;
 static char *opt_password= 0;
 static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 
+static char *cnf_file_path= 0, defaults_file[FN_REFLEN + 32];
+
 static my_bool tty_password= 0;
 
 static char opt_tmpdir[FN_REFLEN] = "";
@@ -109,6 +111,7 @@ static struct my_option my_long_options[]=
    &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#define PASSWORD_OPT 12
   {"password", 'p',
    "Password to use when connecting to server. If password is not given,"
    " it's solicited on the tty.", &opt_password,&opt_password,
@@ -146,6 +149,7 @@ static struct my_option my_long_options[]=
    "do not try to upgrade the data.",
    &opt_systables_only, &opt_systables_only, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#define USER_OPT (array_elements(my_long_options) - 6)
   {"user", 'u', "User for login if not current user.", &opt_user,
    &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"verbose", 'v', "Display more output about the process.",
@@ -182,6 +186,8 @@ static void free_used_memory(void)
 
   dynstr_free(&ds_args);
   dynstr_free(&conn_args);
+  if (cnf_file_path)
+    my_delete(cnf_file_path, MYF(MY_WME));
 }
 
 
@@ -233,31 +239,32 @@ static void verbose(const char *fmt, ...)
   this way we pass the same arguments on to mysql and mysql_check
 */
 
-static void add_one_option(DYNAMIC_STRING* ds,
-                           const struct my_option *opt,
-                           const char* argument)
-
+static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
+                                    const struct my_option *opt,
+                                    const char* arg)
 {
-  const char* eq= NullS;
-  const char* arg= NullS;
-  if (opt->arg_type != NO_ARG)
+  dynstr_append(ds, "--");
+  dynstr_append(ds, opt->name);
+  if (arg)
   {
-    eq= "=";
-    switch (opt->var_type & GET_TYPE_MASK) {
-    case GET_STR:
-      arg= argument;
-      break;
-    case GET_BOOL:
-      arg= (*(my_bool *)opt->value) ? "1" : "0";
-      break;
-    default:
-      die("internal error at %s: %d",__FILE__, __LINE__);
-    }
+    dynstr_append(ds, "=");
+    dynstr_append_os_quoted(ds, arg, NullS);
   }
-  dynstr_append_os_quoted(ds, "--", opt->name, eq, arg, NullS);
   dynstr_append(ds, " ");
 }
 
+static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
+                                    const struct my_option *opt,
+                                    const char* arg)
+{
+  dynstr_append(ds, opt->name);
+  if (arg)
+  {
+    dynstr_append(ds, "=");
+    dynstr_append_os_quoted(ds, arg, NullS);
+  }
+  dynstr_append(ds, "\n");
+}
 
 static my_bool
 get_one_option(int optid, const struct my_option *opt,
@@ -288,16 +295,17 @@ get_one_option(int optid, const struct my_option *opt,
   case 'p':
     if (argument == disabled_my_option)
       argument= (char*) "";			/* Don't require password */
-    tty_password= 1;
     add_option= FALSE;
     if (argument)
     {
       /* Add password to ds_args before overwriting the arg with x's */
-      add_one_option(&ds_args, opt, argument);
+      add_one_option_cnf_file(&ds_args, opt, argument);
       while (*argument)
         *argument++= 'x';                       /* Destroy argument */
       tty_password= 0;
     }
+    else
+      tty_password= 1;
     break;
 
   case 't':
@@ -344,18 +352,18 @@ get_one_option(int optid, const struct my_option *opt,
   case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
   case OPT_PLUGIN_DIR:                          /* --plugin-dir */
   case OPT_DEFAULT_AUTH:                        /* --default-auth */
-    add_one_option(&conn_args, opt, argument);
+    add_one_option_cmd_line(&conn_args, opt, argument);
     break;
   }
 
   if (add_option)
   {
     /*
-      This is an option that is accpted by mysql_upgrade just so
+      This is an option that is accepted by mysql_upgrade just so
       it can be passed on to "mysql" and "mysqlcheck"
       Save it in the ds_args string
     */
-    add_one_option(&ds_args, opt, argument);
+    add_one_option_cnf_file(&ds_args, opt, argument);
   }
   return 0;
 }
@@ -415,11 +423,8 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
 
   while ((arg= va_arg(args, char *)))
   {
-    /* Options should be os quoted */
-    if (strncmp(arg, "--", 2) == 0)
-      dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
-    else
-      dynstr_append(&ds_cmdline, arg);
+    /* Options should already be os quoted */
+    dynstr_append(&ds_cmdline, arg);
     dynstr_append(&ds_cmdline, " ");
   }
 
@@ -561,8 +566,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
 
   ret= run_tool(mysql_path,
                 ds_res,
-                "--no-defaults",
-                ds_args.str,
+                defaults_file,
                 "--database=mysql",
                 "--batch", /* Turns off pager etc. */
                 force ? "--force": "--skip-force",
@@ -751,8 +755,7 @@ static int run_mysqlcheck_upgrade(void)
   print_conn_args("mysqlcheck");
   retch= run_tool(mysqlcheck_path,
                   NULL, /* Send output from mysqlcheck directly to screen */
-                  "--no-defaults",
-                  ds_args.str,
+                  defaults_file,
                   "--check-upgrade",
                   "--all-databases",
                   "--auto-repair",
@@ -805,8 +808,7 @@ static int run_mysqlcheck_views(void)
   print_conn_args("mysqlcheck");
   return run_tool(mysqlcheck_path,
                   NULL, /* Send output from mysqlcheck directly to screen */
-                  "--no-defaults",
-                  ds_args.str,
+                  defaults_file,
                   "--all-databases", "--repair",
                   upgrade_views,
                   "--skip-process-tables",
@@ -830,8 +832,7 @@ static int run_mysqlcheck_fixnames(void)
   print_conn_args("mysqlcheck");
   return run_tool(mysqlcheck_path,
                   NULL, /* Send output from mysqlcheck directly to screen */
-                  "--no-defaults",
-                  ds_args.str,
+                  defaults_file,
                   "--all-databases",
                   "--fix-db-names",
                   "--fix-table-names",
@@ -1031,12 +1032,21 @@ int main(int argc, char **argv)
   {
     opt_password= get_tty_password(NullS);
     /* add password to defaults file */
-    dynstr_append_os_quoted(&ds_args, "--password=", opt_password, NullS);
-    dynstr_append(&ds_args, " ");
+    add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
+    DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
   }
   /* add user to defaults file */
-  dynstr_append_os_quoted(&ds_args, "--user=", opt_user, NullS);
-  dynstr_append(&ds_args, " ");
+  add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
+  DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
+
+  cnf_file_path= strmov(defaults_file, "--defaults-file=");
+  {
+    int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
+                             "mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
+    my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
+    my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
+    my_close(fd, MYF(0));
+  }
 
   /* Find mysql */
   find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 37ede5c..267d847 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2001, 2011, Oracle and/or its affiliates.
-   Copyright (c) 2010, 2011, Monty Program Ab.
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/client/mysqldump.c b/client/mysqldump.c
index b649e63..74fd4f6 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2000, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2010, 2013, Monty Program Ab.
+   Copyright (c) 2010, 2015, Monty Program Ab.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1116,16 +1116,14 @@ static int fetch_db_collation(const char *db_name,
                               int db_cl_size)
 {
   my_bool err_status= FALSE;
-  char query[QUERY_LENGTH];
   MYSQL_RES *db_cl_res;
   MYSQL_ROW db_cl_row;
-  char quoted_database_buf[NAME_LEN*2+3];
-  char *qdatabase= quote_name(db_name, quoted_database_buf, 1);
 
-  my_snprintf(query, sizeof (query), "use %s", qdatabase);
-
-  if (mysql_query_with_error_report(mysql, NULL, query))
-    return 1;
+  if (mysql_select_db(mysql, db_name))
+  {
+    DB_error(mysql, "when selecting the database");
+    return 1;                   /* If --force */
+  }
 
   if (mysql_query_with_error_report(mysql, &db_cl_res,
                                     "select @@collation_database"))
@@ -2319,7 +2317,7 @@ static uint dump_routines_for_db(char *db)
 
   /* Get database collation. */
 
-  if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name)))
+  if (fetch_db_collation(db, db_cl_name, sizeof (db_cl_name)))
     DBUG_RETURN(1);
 
   if (switch_character_set_results(mysql, "binary"))
@@ -2388,7 +2386,7 @@ static uint dump_routines_for_db(char *db)
 
             if (mysql_num_fields(routine_res) >= 6)
             {
-              if (switch_db_collation(sql_file, db_name_buff, ";",
+              if (switch_db_collation(sql_file, db, ";",
                                       db_cl_name, row[5], &db_cl_altered))
               {
                 DBUG_RETURN(1);
@@ -2435,7 +2433,7 @@ static uint dump_routines_for_db(char *db)
 
               if (db_cl_altered)
               {
-                if (restore_db_collation(sql_file, db_name_buff, ";", db_cl_name))
+                if (restore_db_collation(sql_file, db, ";", db_cl_name))
                   DBUG_RETURN(1);
               }
             }
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 5bcdd91..b4514f5 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -1,6 +1,6 @@
 /*
-   Copyright (c) 2000, 2012, Oracle and/or its affiliates.
-   Copyright (c) 2010, 2012, Monty Program Ab
+   Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -369,7 +369,7 @@ list_dbs(MYSQL *mysql,const char *wild)
   uint length, counter = 0;
   ulong rowcount = 0L;
   char tables[NAME_LEN+1], rows[NAME_LEN+1];
-  char query[255];
+  char query[NAME_LEN + 100];
   MYSQL_FIELD *field;
   MYSQL_RES *result;
   MYSQL_ROW row= NULL, rrow;
@@ -436,7 +436,8 @@ list_dbs(MYSQL *mysql,const char *wild)
             MYSQL_ROW trow;
 	    while ((trow = mysql_fetch_row(tresult)))
 	    {
-	      sprintf(query,"SELECT COUNT(*) FROM `%s`",trow[0]);
+              my_snprintf(query, sizeof(query),
+                          "SELECT COUNT(*) FROM `%s`", trow[0]);
 	      if (!(mysql_query(mysql,query)))
 	      {
 		MYSQL_RES *rresult;
@@ -492,7 +493,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
 {
   const char *header;
   uint head_length, counter = 0;
-  char query[255], rows[NAME_LEN], fields[16];
+  char query[NAME_LEN + 100], rows[NAME_LEN], fields[16];
   MYSQL_FIELD *field;
   MYSQL_RES *result;
   MYSQL_ROW row, rrow;
@@ -577,7 +578,8 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
 	  if (opt_verbose > 1)
 	  {
             /* Print the count of rows for each table */
-	    sprintf(query,"SELECT COUNT(*) FROM `%s`",row[0]);
+            my_snprintf(query, sizeof(query), "SELECT COUNT(*) FROM `%s`",
+                        row[0]);
 	    if (!(mysql_query(mysql,query)))
 	    {
 	      if ((rresult = mysql_store_result(mysql)))
@@ -637,13 +639,15 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
 static int
 list_table_status(MYSQL *mysql,const char *db,const char *wild)
 {
-  char query[1024],*end;
+  char query[NAME_LEN + 100];
+  int len;
   MYSQL_RES *result;
   MYSQL_ROW row;
 
-  end=strxmov(query,"show table status from `",db,"`",NullS);
-  if (wild && wild[0])
-    strxmov(end," like '",wild,"'",NullS);
+  len= sizeof(query);
+  len-= my_snprintf(query, len, "show table status from `%s`", db);
+  if (wild && wild[0] && len)
+    strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
   if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
   {
     fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
@@ -675,7 +679,8 @@ static int
 list_fields(MYSQL *mysql,const char *db,const char *table,
 	    const char *wild)
 {
-  char query[1024],*end;
+  char query[NAME_LEN + 100];
+  int len;
   MYSQL_RES *result;
   MYSQL_ROW row;
   ulong UNINIT_VAR(rows);
@@ -689,7 +694,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
 
   if (opt_count)
   {
-    sprintf(query,"select count(*) from `%s`", table);
+    my_snprintf(query, sizeof(query), "select count(*) from `%s`", table);
     if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
     {
       fprintf(stderr,"%s: Cannot get record count for db: %s, table: %s: %s\n",
@@ -701,9 +706,11 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
     mysql_free_result(result);
   }
 
-  end=strmov(strmov(strmov(query,"show /*!32332 FULL */ columns from `"),table),"`");
-  if (wild && wild[0])
-    strxmov(end," like '",wild,"'",NullS);
+  len= sizeof(query);
+  len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
+                    table);
+  if (wild && wild[0] && len)
+    strxnmov(query + strlen(query), len, " like '", wild, "'", NullS);
   if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
   {
     fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n",
@@ -724,7 +731,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
   print_res_top(result);
   if (opt_show_keys)
   {
-    end=strmov(strmov(strmov(query,"show keys from `"),table),"`");
+    my_snprintf(query, sizeof(query), "show keys from `%s`", table);
     if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
     {
       fprintf(stderr,"%s: Cannot list keys in db: %s, table: %s: %s\n",
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index bd8d961..c5af3e6 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -31,7 +31,7 @@ SET(CPACK_RPM_PACKAGE_NAME "MariaDB")
 SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
 
 SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
-SET(CPACK_RPM_PACKAGE_LICENSE "GPL")
+SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
 SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
 SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
 SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org")
diff --git a/debian/mariadb-server-5.5.mysql-server.logrotate b/debian/mariadb-server-5.5.mysql-server.logrotate
index 0f0de51..789ad35 100644
--- a/debian/mariadb-server-5.5.mysql-server.logrotate
+++ b/debian/mariadb-server-5.5.mysql-server.logrotate
@@ -2,7 +2,7 @@
 #   flush-logs'd only once.
 #   Else the binary logs would automatically increase by n times every day.
 # - The error log is obsolete, messages go to syslog now.
-/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log {
+/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log {
 	daily
 	rotate 7
 	missingok
diff --git a/libmysql/conf_to_src.c b/libmysql/conf_to_src.c
index a5a7d23..0e92388 100644
--- a/libmysql/conf_to_src.c
+++ b/libmysql/conf_to_src.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ print_arrays_for(char *set)
 {
   FILE *f;
 
-  sprintf(buf, "%s.conf", set);
+  snprintf(buf, sizeof(buf), "%s.conf", set);
 
   if ((f = fopen(buf, "r")) == NULL) {
     fprintf(stderr, "%s: can't read conf file for charset %s\n", prog, set);
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 96848c3..40d699c 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -38,6 +38,9 @@ max_heap_table_size=        1M
 loose-aria-pagecache-buffer-size=8M
 
 loose-feedback-user-info=  mysql-test
+loose-feedback-debug-startup-interval=20
+loose-feedback-debug-first-interval=60
+loose-feedback-debug-interval=60
 
 loose-innodb_data_file_path=      ibdata1:10M:autoextend
 loose-innodb_buffer_pool_size=    8M
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 8dd3cc8..327b53c 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -2477,3 +2477,9 @@ t1	CREATE TABLE `t1` (
   `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
+set @@session.collation_server=filename;
+create table t1(a enum('',''));
+Warnings:
+Note	1291	Column 'a' has duplicated value '' in ENUM
+drop table t1;
+set @@session.collation_server=default;
diff --git a/mysql-test/r/ctype_filename.result b/mysql-test/r/ctype_filename.result
index acc32c7..ac8df47 100644
--- a/mysql-test/r/ctype_filename.result
+++ b/mysql-test/r/ctype_filename.result
@@ -11,3 +11,6 @@ create table com1 (a int);
 drop table com1;
 create table `clock$` (a int);
 drop table `clock$`;
+select convert(convert(',' using filename) using binary);
+convert(convert(',' using filename) using binary)
+ at 002c
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index a964384..91dbe85 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -5777,5 +5777,32 @@ SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
 ERROR 21000: Subquery returns more than 1 row
 DROP TABLE t1, t2;
 #
+# MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
+#
+SET NAMES utf8;
+CREATE TABLE t1 (id2 int, ts timestamp);
+INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
+CREATE TABLE t2 AS SELECT
+COALESCE(ts, 0) AS c0,
+GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
+GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
+GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
+GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
+FROM t1;
+SHOW CREATE TABLE t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `c0` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `c2` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `c3` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `c4` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t2;
+c0	c1	c2	c3	c4
+2012-06-11 15:17:34	2012-06-11 15:17:34	2012-06-11 15:17:34	2012-06-11 15:17:34	2012-06-11 15:17:34
+2012-06-11 15:18:24	2012-06-11 15:18:24	2012-06-11 15:18:24	2012-06-11 15:18:24	2012-06-11 15:18:24
+DROP TABLE t2, t1;
+#
 # End of 5.5 tests
 #
diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result
index 5a64cf1..e03ccf5 100644
--- a/mysql-test/r/events_1.result
+++ b/mysql-test/r/events_1.result
@@ -114,7 +114,7 @@ create table t_event3 (a int, b float);
 drop event if exists event3;
 Warnings:
 Note	1305	Event event3 does not exist
-create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
 select count(*) from t_event3;
 count(*)
 0
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index b93c70f..ad93bfc 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -551,7 +551,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
 DROP TABLE t1;
 CREATE TABLE t1(a TEXT);
 SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
-ERROR HY000: Incorrect arguments to AGAINST
+ERROR HY000: Incorrect arguments to MATCH
 DROP TABLE t1;
 CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
 INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
diff --git a/mysql-test/r/mysql_plugin.result b/mysql-test/r/mysql_plugin.result
index 636b039..0bcb47e 100644
--- a/mysql-test/r/mysql_plugin.result
+++ b/mysql-test/r/mysql_plugin.result
@@ -102,7 +102,7 @@ ERROR: Missing --plugin_dir option.
 # Show the help.
 #
 mysql_plugin  Ver V.V.VV Distrib XX.XX.XX
-Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 
 Enable or disable plugins.
 
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 8b8fea2..5f81ee5 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -36,7 +36,7 @@ Phase 4/4: Running 'mysql_fix_privilege_tables'
 OK
 Run it again - should say already completed
 This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
-Force should run it regardless of wether it's been run before
+Force should run it regardless of whether it has been run before
 Phase 1/4: Fixing views
 Phase 2/4: Fixing table and database names
 Phase 3/4: Checking and upgrading tables
@@ -298,6 +298,13 @@ test
 Phase 4/4: Running 'mysql_fix_privilege_tables'
 OK
 #
+# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
+#
+Run mysql_upgrade with unauthorized access
+Version check failed. Got the following error when calling the 'mysql' command line client
+ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
+FATAL ERROR: Upgrade failed
+#
 # MDEV-4332 Increase username length from 16 characters
 # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
 #
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 43601f4..b205b81 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5312,3 +5312,29 @@ Usage: mysqldump [OPTIONS] database [tables]
 OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
 OR     mysqldump [OPTIONS] --all-databases [OPTIONS]
 For more options, use mysqldump --help
+#
+# MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
+#
+CREATE DATABASE `a\"'``b`;
+USE `a\"'``b`;
+CREATE PROCEDURE p1() BEGIN END;
+ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
+ALTER DATABASE `a\"'``b` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
+/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client  = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection  = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
+/*!50003 SET sql_mode              = '' */ ;
+DELIMITER ;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+BEGIN END ;;
+DELIMITER ;
+/*!50003 SET sql_mode              = @saved_sql_mode */ ;
+/*!50003 SET character_set_client  = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection  = @saved_col_connection */ ;
+ALTER DATABASE `a\"'``b` CHARACTER SET utf8 COLLATE utf8_general_ci ;
+DROP DATABASE `a\"'``b`;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 1438595..04a19d3 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4052,3 +4052,24 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
 ERROR 22003: BIGINT UNSIGNED value is out of range in '(18446744073709551615 + 1)'
 drop table t1;
 # End of 5.3 tests
+#
+# MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
+#
+CREATE TABLE t1 ( id INT(10), value INT(10) );
+CREATE TABLE t2 ( id INT(10) );
+SET @save_sql_mode= @@sql_mode;
+SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
+PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
+execute stmt;
+insert into t1 values (1,10),(2,10),(3,10);
+insert into t2 values (1),(2);
+execute stmt;
+select * from t1;
+id	value
+1	1
+2	1
+3	NULL
+deallocate prepare stmt;
+SET SESSION sql_mode = @save_sql_mode;
+DROP TABLE t1,t2;
+# End of 10.0 tests
diff --git a/mysql-test/r/ps_change_master.result b/mysql-test/r/ps_change_master.result
new file mode 100644
index 0000000..25069a5
--- /dev/null
+++ b/mysql-test/r/ps_change_master.result
@@ -0,0 +1,22 @@
+#
+# CHANGE MASTER TO doesn't work with prepared statements
+#
+CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
+# Master_Host : host1
+# Master_User : user1
+SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+# Master_Host : host2
+# Master_User : user1
+SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+# Master_Host : host2
+# Master_User : user2
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
+# End of test
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 3942f51..a19d906 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -2100,3 +2100,16 @@ count(*)
 40960
 drop table t1;
 set names default;
+create table t2 (a int, b int, c int, d int, key x(a, b));
+insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
+(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
+insert into t2 select * from t2;
+insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
+analyze table t2;
+Table	Op	Msg_type	Msg_text
+test.t2	analyze	status	OK
+select a, b from t2 where (a, b) in ((0, 0), (1, 1));
+a	b
+0	0
+1	1
+drop table t2;
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 11a1687..9a08910 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -2102,4 +2102,17 @@ count(*)
 40960
 drop table t1;
 set names default;
+create table t2 (a int, b int, c int, d int, key x(a, b));
+insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
+(6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
+insert into t2 select * from t2;
+insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
+analyze table t2;
+Table	Op	Msg_type	Msg_text
+test.t2	analyze	status	OK
+select a, b from t2 where (a, b) in ((0, 0), (1, 1));
+a	b
+0	0
+1	1
+drop table t2;
 set optimizer_switch=@mrr_icp_extra_tmp;
diff --git a/mysql-test/r/show_row_order-9226.result b/mysql-test/r/show_row_order-9226.result
new file mode 100644
index 0000000..b8c8de6
--- /dev/null
+++ b/mysql-test/r/show_row_order-9226.result
@@ -0,0 +1,80 @@
+create table test_table (
+column_number_1 enum('1','2') not null,
+column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
+column_number_3 varchar(10) not null,
+column_number_4 varchar(10) not null,
+column_number_5 enum(
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
+ ) not null,
+column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96', [...]
+column_number_7 enum('1','2','3','4','5','6','7') not null,
+column_number_8 enum('8') not null,
+column_number_9 enum('9') not null,
+column_number_10 varchar(10) not null,
+column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
+) default charset=utf8mb4;
+show columns from test_table;
+Field	Type	Null	Key	Default	Extra
+column_number_1	enum('1','2')	NO		NULL	
+column_number_2	enum('1','2','3','4','5','6','7','8','9','10','11','12')	NO		NULL	
+column_number_3	varchar(10)	NO		NULL	
+column_number_4	varchar(10)	NO		NULL	
+column_number_5	enum('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [...]
+column_number_6	enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96', [...]
+column_number_7	enum('1','2','3','4','5','6','7')	NO		NULL	
+column_number_8	enum('8')	NO		NULL	
+column_number_9	enum('9')	NO		NULL	
+column_number_10	varchar(10)	NO		NULL	
+column_number_11	enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49')	NO		NULL	
+drop table test_table;
diff --git a/mysql-test/r/udf_notembedded.result b/mysql-test/r/udf_notembedded.result
new file mode 100644
index 0000000..3fdcdbb
--- /dev/null
+++ b/mysql-test/r/udf_notembedded.result
@@ -0,0 +1,6 @@
+create function sequence returns integer soname "UDF_EXAMPLE_LIB";
+create table t1 (n int key not null auto_increment,  msg int as (sequence()) virtual);
+select * from t1;
+n	msg
+drop table t1;
+drop function sequence;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 3ea5855..0b036ca 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -618,3 +618,62 @@ Variable_name	Value
 Handler_update	5
 ROLLBACK;
 DROP TABLE t1, t2;
+#
+# MDEV-8938: Server Crash on Update with joins
+#
+CREATE TABLE `t1` (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
+drop table t1;
+CREATE TABLE `t1` (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+create table t2 (
+`name` varchar(255) NOT NULL,
+`value` varchar(4095) DEFAULT NULL,
+PRIMARY KEY (`name`)
+);
+UPDATE t1
+SET value = (SELECT value FROM t2 WHERE `name`= t1.name) 
+WHERE value is null ;
+drop table t1,t2;
+#
+#MDEV-8701: Crash on derived query
+#
+CREATE TABLE t1 (
+data_exit_entry_id int(11) NOT NULL,
+data_entry_id int(11) NOT NULL,
+data_entry_exit_id int(11) NOT NULL,
+data_exit_entry_quantity double NOT NULL
+) DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+data_entry_id int(11) NOT NULL,
+data_entry_cost double NOT NULL,
+data_entry_quantity double NOT NULL
+) DEFAULT CHARSET=utf8;
+create  algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
+FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
+UPDATE t2 
+SET data_entry_cost
+= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
+FROM 
+v1 AS query 
+WHERE data_entry_exit_id = t2.data_entry_id
+)
+);
+UPDATE t2 
+SET data_entry_cost
+= ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
+FROM 
+( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
+FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query 
+WHERE data_entry_exit_id = t2.data_entry_id
+)
+);
+drop view v1;
+drop table t1, t2;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 57065d7..b008e62 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5479,6 +5479,39 @@ UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
 EXECUTE stmt;
 DROP TABLE t1, t2, t3;
 DROP VIEW v3;
+#
+# MDEV-8632: Segmentation fault on INSERT
+#
+CREATE TABLE `t1` (
+`id` int(10) unsigned NOT NULL,
+`r` float NOT NULL,
+PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+create view v1 as select id, if(r=r,1,2) as d from t1;
+create view v2 as
+select id, 
+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+from v1;
+insert into t1 (id, r)
+select id,p from
+(
+select id, 
+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+from (
+select id, if(r=r,1,2) as d
+from t1
+) a
+) b
+on duplicate key update r=p;
+insert into t1 (id, r)
+select id,p from v2 
+on duplicate key update r=p;
+prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+drop view v1,v2;
+drop table `t1`;
 # -----------------------------------------------------------------
 # -- End of 5.5 tests.
 # -----------------------------------------------------------------
diff --git a/mysql-test/suite/federated/error_on_close-8313.result b/mysql-test/suite/federated/error_on_close-8313.result
new file mode 100644
index 0000000..93b0edb
--- /dev/null
+++ b/mysql-test/suite/federated/error_on_close-8313.result
@@ -0,0 +1,27 @@
+CREATE DATABASE federated;
+CREATE DATABASE federated;
+connection slave;
+create table t1 (foo int, bar int);
+connection master;
+create server 's1' foreign data wrapper 'mysql' options
+(HOST 'localhost',
+DATABASE 'test',
+USER 'root',
+PASSWORD '',
+SOCKET 'SLAVE_MYSOCK');
+create table t1 (foo integer, bar integer) engine=federated
+connection='s1';
+select * from t1;
+foo	bar
+connection slave;
+connection master;
+drop table t1;
+drop server s1;
+connection slave;
+drop table t1;
+connection master;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+connection slave;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/error_on_close-8313.test b/mysql-test/suite/federated/error_on_close-8313.test
new file mode 100644
index 0000000..b0b1286
--- /dev/null
+++ b/mysql-test/suite/federated/error_on_close-8313.test
@@ -0,0 +1,38 @@
+#
+# MDEV-8313 Got an error writing communication packets
+#
+source include/federated.inc;
+
+enable_connect_log;
+
+connection slave;
+create table t1 (foo int, bar int);
+
+connection master;
+
+--replace_result $SLAVE_MYSOCK SLAVE_MYSOCK
+eval create server 's1' foreign data wrapper 'mysql' options
+  (HOST 'localhost',
+  DATABASE 'test',
+  USER 'root',
+  PASSWORD '',
+  SOCKET '$SLAVE_MYSOCK');
+
+
+eval create table t1 (foo integer, bar integer) engine=federated
+  connection='s1';
+
+select * from t1;
+
+connection slave;
+source include/restart_mysqld.inc;
+
+connection master;
+drop table t1;
+drop server s1;
+
+connection slave;
+drop table t1;
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/suite/innodb/r/dropdb.result b/mysql-test/suite/innodb/r/dropdb.result
new file mode 100644
index 0000000..6b11b5e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/dropdb.result
@@ -0,0 +1,9 @@
+#
+# Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
+#
+set session default_storage_engine=innodb;
+create database `b`;
+use `b`;
+create table `#mysql50#q.q` select 1;
+ERROR 42000: Incorrect table name '#mysql50#q.q'
+drop database `b`;
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 6a232cf..2ea6869 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -567,7 +567,7 @@ Variable_name	Value
 auto_increment_increment	65535
 auto_increment_offset	65535
 INSERT INTO t1 VALUES (NULL),(NULL);
-ERROR 22003: Out of range value for column 'c1' at row 1
+ERROR HY000: Failed to read auto-increment value from storage engine
 SELECT * FROM t1;
 c1
 1
@@ -641,6 +641,18 @@ PRIMARY KEY (m)) ENGINE = InnoDB;
 INSERT INTO t2 (n,o) VALUES
 (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
 (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
+SELECT * FROM t2;
+m	n	o
+1	1	TRUE
+2	1	FALSE
+3	2	TRUE
+4	2	FALSE
+5	3	TRUE
+6	3	FALSE
+7	4	TRUE
+8	4	FALSE
+9	5	TRUE
+10	5	FALSE
 SHOW CREATE TABLE t2;
 Table	Create Table
 t2	CREATE TABLE `t2` (
@@ -648,7 +660,7 @@ t2	CREATE TABLE `t2` (
   `n` int(10) unsigned NOT NULL,
   `o` enum('FALSE','TRUE') DEFAULT NULL,
   PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
 INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
 SHOW CREATE TABLE t1;
 Table	Create Table
diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
index 542fc97..b3360d0 100644
--- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result
+++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
@@ -24,7 +24,7 @@ create table t2(a int, constraint a foreign key a (a) references t1(a)) engine=i
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to  foreign key a (a) references t1(a)) engine=innodb.
+Warning	150	Create  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(a)) engine=innodb'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 drop table t1;
 create table t1(a int not null primary key, b int) engine=innodb;
@@ -33,14 +33,14 @@ constraint a foreign key a (a) references t1(b)) engine=innodb;
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to  foreign key a (a) references t1(b)) engine=innodb.
+Warning	150	Create  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key a (a) references t1(b)) engine=innodb'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
 alter table t2 add constraint b foreign key (b) references t2(b);
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns. Error close to  foreign key (b) references t2(b).
+Warning	150	Alter  table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t2, t1;
 create table t1 (f1 integer primary key) engine=innodb;
@@ -48,7 +48,7 @@ alter table t1 add constraint c1 foreign key (f1) references t11(f1);
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary close to  foreign key (f1) references t11(f1).
+Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t1;
 create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -56,13 +56,13 @@ create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(a) references t1(a)) engine=innodb.
+Warning	150	Create  table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(a) references t1(a)) engine=innodb'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 alter table t1 add foreign key(b) references t1(a);
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a).
+Warning	150	Alter  table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'.
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t1;
 create table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -70,7 +70,8 @@ alter table t1 add foreign key(a,b) references t1(a);
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a,b) references t1(a) close to ). Too few referenced columns, you have 1 when you should have 2.
+Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a,b) references t1(a)' near ')'.  Referencing column count 1 does not match referenced column count 2.
+
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t1;
 create table t1(a int not null primary key, b int, key(b)) engine=innodb;
@@ -78,7 +79,8 @@ alter table t1 add foreign key(a) references t1(a,b);
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Foreign key constraint parse error in foreign key(a) references t1(a,b) close to ). Too few referenced columns, you have 2 when you should have 1.
+Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. Parse error in 'foreign key(a) references t1(a,b)' near ')'.  Referencing column count 2 does not match referenced column count 1.
+
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t1;
 create table t1 (f1 integer not null primary key) engine=innodb;
@@ -86,13 +88,13 @@ alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update se
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column f1 is defined as NOT NULL in  foreign key (f1) references t1(f1) on update set null close to  on update set null.
+Warning	150	Alter  table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column a is defined as NOT NULL in foreign key(a) references t1(f1) on delete set null) engine=innodb close to  on delete set null) engine=innodb.
+Warning	150	Create  table `test`.`t2` with foreign key constraint failed. You have defined a SET NULL condition but column 'a' is defined as NOT NULL in 'foreign key(a) references t1(f1) on delete set null) engine=innodb' near ' on delete set null) engine=innodb'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 drop table t1;
 create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
@@ -100,6 +102,6 @@ create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=inn
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table `test`.`t2` with foreign key constraint failed. Field type or character set for column a does not mach referenced column f1 close to foreign key(a) references t1(f1)) engine=innodb
+Warning	150	Create  table `test`.`t2` with foreign key constraint failed. Field type or character set for column 'a' does not mach referenced column 'f1' near 'foreign key(a) references t1(f1)) engine=innodb'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index 2b53bc2..6c3306f 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -50,8 +50,8 @@ CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
 ERROR HY000: Can't create table 'test.t2' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Create  table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to  FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
-) ENGINE=InnoDB.
+Warning	150	Create  table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE
+) ENGINE=InnoDB'.
 Error	1005	Can't create table 'test.t2' (errno: 150)
 CREATE TABLE t2 (
 id int(11) NOT NULL AUTO_INCREMENT,
@@ -64,7 +64,7 @@ ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE
 ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
 show warnings;
 Level	Code	Message
-Warning	150	Alter  table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary close to  FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE.
+Warning	150	Alter  table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
 Error	1005	Can't create table '#sql-temporary' (errno: 150)
 drop table t2;
 drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema_tables.result b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result
new file mode 100644
index 0000000..ea713ea
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_information_schema_tables.result
@@ -0,0 +1,2 @@
+CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/dropdb.test b/mysql-test/suite/innodb/t/dropdb.test
new file mode 100644
index 0000000..7f5ac80
--- /dev/null
+++ b/mysql-test/suite/innodb/t/dropdb.test
@@ -0,0 +1,12 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #19929435 DROP DATABASE HANGS WITH MALFORMED TABLE
+--echo #
+
+set session default_storage_engine=innodb;
+create database `b`;
+use `b`;
+--error ER_WRONG_TABLE_NAME
+create table `#mysql50#q.q` select 1;
+drop database `b`;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index a8dda12..362be2e 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
 SELECT * FROM t1;
 SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
 SHOW VARIABLES LIKE "%auto_inc%";
---error 167
+--error 1467
 INSERT INTO t1 VALUES (NULL),(NULL);
 SELECT * FROM t1;
 DROP TABLE t1;
@@ -401,6 +401,7 @@ CREATE TABLE t2 (
 INSERT INTO t2 (n,o) VALUES
   (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
   (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
+SELECT * FROM t2;
 SHOW CREATE TABLE t2;
 INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
 SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt b/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt
new file mode 100644
index 0000000..9f30d81
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_tables.opt
@@ -0,0 +1,29 @@
+--loose-innodb_trx
+--loose-innodb_locks
+--loose-innodb_lock_waits
+--loose-innodb_cmp
+--loose-innodb_cmp_reset
+--loose-innodb_cmp_per_index
+--loose-innodb_cmp_per_index_reset
+--loose-innodb_cmpmem
+--loose-innodb_cmpmem_reset
+--loose-innodb_buffer_page
+--loose-innodb_buffer_page_lru
+--loose-innodb_buffer_stats
+--loose-innodb_sys_tables
+--loose-innodb_sys_tablestats
+--loose-innodb_sys_indexes
+--loose-innodb_sys_columns
+--loose-innodb_sys_fields
+--loose-innodb_sys_foreign
+--loose-innodb_sys_foreign_cols
+--loose-innodb_changed_pages
+--loose-innodb_rseg
+--loose-innodb_undo_logs
+--loose-innodb_sys_stats
+--loose-innodb_table_stats
+--loose-innodb_index_stats
+--loose-innodb_admin_command
+--loose-innodb_buffer_pool_pages
+--loose-innodb_buffer_pool_pages_index
+--loose-innodb_buffer_pool_pages_blob
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema_tables.test b/mysql-test/suite/innodb/t/innodb_information_schema_tables.test
new file mode 100644
index 0000000..15b3bf4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_information_schema_tables.test
@@ -0,0 +1,64 @@
+-- source include/have_innodb.inc
+-- source include/not_embedded.inc
+
+#
+# MDEV-7762 InnoDB: Failing assertion: block->page.buf_fix_count > 0 in buf0buf.ic line 730
+#
+# Make sure that all supported information_schema tables are readable
+# (actual result sets are not important).
+#
+CREATE TABLE t1 ENGINE=InnoDB AS SELECT * FROM mysql.help_topic;
+
+--disable_query_log
+--disable_result_log
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_STATS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_RSEG;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_UNDO_LOGS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_STATS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLE_STATS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_INDEX_STATS;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_ADMIN_COMMAND;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_INDEX;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_PAGES_BLOB;
+--error 0,1109
+SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES;
+COMMIT;
+--enable_query_log
+--enable_result_log
+DROP TABLE t1;
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result
index 37d26b4..c52fdb8 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_install.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result
@@ -3,7 +3,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
 plugin_status
 ACTIVE
 select * from information_schema.feedback where variable_name like 'feed%'
-       and variable_name not like  '%_uid';
+       and variable_name not like  '%_uid'
+       and variable_name not like '%debug%';
 VARIABLE_NAME	VARIABLE_VALUE
 FEEDBACK used	1
 FEEDBACK version	1.1
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index ea6eae9..e2cf324 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
 variable_value = @feedback_used + 1
 1
 select * from information_schema.feedback where variable_name like 'feed%'
-       and variable_name not like  '%_uid' and variable_name not like 'FEEDBACK used';
+       and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+       and variable_name not like '%debug%';
 VARIABLE_NAME	VARIABLE_VALUE
 FEEDBACK version	1.1
 FEEDBACK_SEND_RETRY_WAIT	60
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 90a37f7..1037867 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -6,14 +6,14 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
 variable_value = @feedback_used + 1
 1
 select * from information_schema.feedback where variable_name like 'feed%'
-       and variable_name not like  '%_uid' and variable_name not like 'FEEDBACK used';
+       and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+       and variable_name not like '%debug%';
 VARIABLE_NAME	VARIABLE_VALUE
 FEEDBACK version	1.1
 FEEDBACK_SEND_RETRY_WAIT	60
 FEEDBACK_SEND_TIMEOUT	60
 FEEDBACK_URL	http://mariadb.org/feedback_plugin/post
 FEEDBACK_USER_INFO	mysql-test
-feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
-feedback plugin: server replied 'ok'
-feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
-feedback plugin: server replied 'ok'
+set global sql_mode=ONLY_FULL_GROUP_BY;
+6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
+6: feedback plugin: server replied 'ok'
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_install.test b/mysql-test/suite/plugins/t/feedback_plugin_install.test
index 81343c4..559dceb 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_install.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_install.test
@@ -10,6 +10,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
 --replace_result https http
 --sorted_result
 select * from information_schema.feedback where variable_name like 'feed%'
-       and variable_name not like  '%_uid';
+       and variable_name not like  '%_uid'
+       and variable_name not like '%debug%';
+
 uninstall plugin feedback;
 
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index f7c62b9..f626f1b 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -24,4 +24,5 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
 --replace_result https http
 --sorted_result
 select * from information_schema.feedback where variable_name like 'feed%'
-       and variable_name not like  '%_uid' and variable_name not like 'FEEDBACK used';
+       and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+       and variable_name not like '%debug%';
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index 31542c3..b28f9d4 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -13,7 +13,11 @@ if (!$MTR_FEEDBACK_PLUGIN) {
 # Let's wait, and hope that mtr is started with --parallel and
 # is doing some work in other workers.
 #
-sleep 310;
+
+sleep 100;
+set global sql_mode=ONLY_FULL_GROUP_BY;
+sleep 210;
+
 
 # The test expects that the plugin will send a report at least 2 times,
 # now (5 min after loading) and on server shutdown which happens below. 
@@ -25,20 +29,15 @@ sleep 310;
 --let $shutdown_timeout= 60
 source include/restart_mysqld.inc;
 
-replace_result https http;
+replace_result https http 2 6;
 perl;
   $log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
   open(LOG, '<', $log_error) or die "open(< $log_error): $!";
 
-  # Get the first few rows (as there may be different number rows in the log)
-  $i= 0;
-  while ($_=<LOG>)
-  {
-    if (/feedback plugin:.*/)
-    {
-      print "$&\n";
-      break if ($i++ >= 3);
-    }
+  %logg=();
+  while ($_=<LOG>) {
+    $logg{$&}++ if /feedback plugin:.*/;
   }
+  print "$logg{$_}: $_\n" for sort keys %logg;
   close LOG;
 EOF
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 6de2c50..e066dc6 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -2053,3 +2053,11 @@ select * from t1;
 show create table t1;
 
 drop table t1;
+
+#
+# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
+#
+set @@session.collation_server=filename;
+create table t1(a enum('',''));
+drop table t1;
+set @@session.collation_server=default;
diff --git a/mysql-test/t/ctype_filename.test b/mysql-test/t/ctype_filename.test
index 436ccfc..4c501a8 100644
--- a/mysql-test/t/ctype_filename.test
+++ b/mysql-test/t/ctype_filename.test
@@ -19,3 +19,6 @@ drop table com1;
 
 create table `clock$` (a int);
 drop table `clock$`;
+
+select convert(convert(',' using filename) using binary);
+
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index bed026a..8cd70e9 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1631,6 +1631,22 @@ INSERT INTO t2 VALUES ('aaa');
 SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
 DROP TABLE t1, t2;
 
+--echo #
+--echo # MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
+--echo #
+SET NAMES utf8;
+CREATE TABLE t1 (id2 int, ts timestamp);
+INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
+CREATE TABLE t2 AS SELECT
+  COALESCE(ts, 0) AS c0,
+  GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
+  GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
+  GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
+  GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
+FROM t1;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
 
 --echo #
 --echo # End of 5.5 tests
diff --git a/mysql-test/t/events_1.test b/mysql-test/t/events_1.test
index 7f31e3f..032d5ec 100644
--- a/mysql-test/t/events_1.test
+++ b/mysql-test/t/events_1.test
@@ -125,7 +125,7 @@ drop event existant;
 
 create table t_event3 (a int, b float);
 drop event if exists event3;
-create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
+create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
 let $wait_condition=SELECT count(*)=0 from t_event3;
 --source include/wait_condition.inc
 select count(*) from t_event3;
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 13be03a..86de04a 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -19,7 +19,7 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 # It should have created a file in the MySQL Servers datadir
 file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
 
---echo Force should run it regardless of wether it's been run before
+--echo Force should run it regardless of whether it has been run before
 --exec $MYSQL_UPGRADE --force 2>&1
 
 # It should have created a file in the MySQL Servers datadir
@@ -129,6 +129,13 @@ let $MYSQLD_DATADIR= `select @@datadir`;
 # so the following command should never fail.
 --remove_file $MYSQLD_DATADIR/mysql_upgrade_info
 
+--echo #
+--echo # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
+--echo #
+
+--echo Run mysql_upgrade with unauthorized access
+--error 1
+--exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1
 
 # 5.5-only test (involves manual modification of system tables)
 --echo #
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index e0c0ce3..b028574 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2494,3 +2494,13 @@ DROP DATABASE db_20772273;
 --exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out
 --exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out
 
+
+--echo #
+--echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
+--echo #
+CREATE DATABASE `a\"'``b`;
+USE `a\"'``b`;
+CREATE PROCEDURE p1() BEGIN END;
+ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
+--exec $MYSQL_DUMP --routines --compact a\\\"\'\`b 2>&1
+DROP DATABASE `a\"'``b`;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 9775a8d..2ed5bb1 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3633,3 +3633,25 @@ SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
 drop table t1;
 
 --echo # End of 5.3 tests
+
+--echo #
+--echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
+--echo #
+
+CREATE TABLE t1 ( id INT(10), value INT(10) );
+CREATE TABLE t2 ( id INT(10) );
+SET @save_sql_mode= @@sql_mode;
+SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
+
+PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)'; 
+execute stmt;
+insert into t1 values (1,10),(2,10),(3,10);
+insert into t2 values (1),(2);
+execute stmt;
+select * from t1;
+deallocate prepare stmt;
+SET SESSION sql_mode = @save_sql_mode;
+DROP TABLE t1,t2;
+
+
+--echo # End of 10.0 tests
diff --git a/mysql-test/t/ps_change_master.test b/mysql-test/t/ps_change_master.test
new file mode 100644
index 0000000..d756b8c
--- /dev/null
+++ b/mysql-test/t/ps_change_master.test
@@ -0,0 +1,45 @@
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--echo #
+--echo # CHANGE MASTER TO doesn't work with prepared statements
+--echo #
+
+CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
+PREPARE stmt FROM @s;
+EXECUTE stmt;
+# Multiple executions should not hurt.
+EXECUTE stmt;
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
+let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
+let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
+
+--echo # Master_Host : $master_host
+--echo # Master_User : $master_user
+
+
+# Reset
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
+
+--echo # End of test
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 0b8e1a9..b73b09d 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1677,3 +1677,15 @@ select count(*) from t1 ignore index (ix_fd) where fd <'😁';
 
 drop table t1;
 set names default;
+
+#
+# Bug#17755540 VALGRIND ERROR WHEN SETTING UP ROW COMPARATORS
+#
+create table t2 (a int, b int, c int, d int, key x(a, b));
+insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
+  (6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
+insert into t2 select * from t2;
+insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
+analyze table t2;
+select a, b from t2 where (a, b) in ((0, 0), (1, 1));
+drop table t2;
diff --git a/mysql-test/t/show_row_order-9226.test b/mysql-test/t/show_row_order-9226.test
new file mode 100644
index 0000000..06df240
--- /dev/null
+++ b/mysql-test/t/show_row_order-9226.test
@@ -0,0 +1,73 @@
+#
+# MDEV-9226 SHOW COLUMNS returns wrong column order for tables with large ENUMs
+#
+create table test_table (
+ column_number_1 enum('1','2') not null,
+ column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
+ column_number_3 varchar(10) not null,
+ column_number_4 varchar(10) not null,
+ column_number_5 enum(
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
+'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
+ ) not null,
+ column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96' [...]
+ column_number_7 enum('1','2','3','4','5','6','7') not null,
+ column_number_8 enum('8') not null,
+ column_number_9 enum('9') not null,
+ column_number_10 varchar(10) not null,
+ column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
+) default charset=utf8mb4;
+# SHOW command must list columns in the table order
+# (SELECT isn't required to do it, though)
+show columns from test_table;
+drop table test_table;
diff --git a/mysql-test/t/udf_notembedded.test b/mysql-test/t/udf_notembedded.test
new file mode 100644
index 0000000..bf54af7
--- /dev/null
+++ b/mysql-test/t/udf_notembedded.test
@@ -0,0 +1,14 @@
+--source include/not_embedded.inc
+--source include/have_udf.inc
+
+#
+# MDEV-8644 Using a UDF in a virtual column causes a crash when stopping the server
+#
+--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
+eval create function sequence returns integer soname "$UDF_EXAMPLE_SO";
+create table t1 (n int key not null auto_increment,  msg int as (sequence()) virtual);
+select * from t1;
+source include/restart_mysqld.inc;
+drop table t1;
+drop function sequence;
+
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index be97dd0..e9d7ff2 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -559,3 +559,76 @@ SHOW STATUS LIKE 'HANDLER_UPDATE';
 ROLLBACK;
 DROP TABLE t1, t2;
 
+--echo #
+--echo # MDEV-8938: Server Crash on Update with joins
+--echo #
+
+CREATE TABLE `t1` (
+  `name` varchar(255) NOT NULL,
+  `value` varchar(4095) DEFAULT NULL,
+  PRIMARY KEY (`name`)
+);
+
+UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
+
+drop table t1;
+
+CREATE TABLE `t1` (
+  `name` varchar(255) NOT NULL,
+  `value` varchar(4095) DEFAULT NULL,
+  PRIMARY KEY (`name`)
+);
+
+create table t2 (
+  `name` varchar(255) NOT NULL,
+  `value` varchar(4095) DEFAULT NULL,
+  PRIMARY KEY (`name`)
+);
+
+UPDATE t1
+SET value = (SELECT value FROM t2 WHERE `name`= t1.name) 
+WHERE value is null ;
+
+drop table t1,t2;
+
+--echo #
+--echo #MDEV-8701: Crash on derived query
+--echo #
+
+CREATE TABLE t1 (
+  data_exit_entry_id int(11) NOT NULL,
+  data_entry_id int(11) NOT NULL,
+  data_entry_exit_id int(11) NOT NULL,
+  data_exit_entry_quantity double NOT NULL
+) DEFAULT CHARSET=utf8;
+
+CREATE TABLE t2 (
+  data_entry_id int(11) NOT NULL,
+  data_entry_cost double NOT NULL,
+  data_entry_quantity double NOT NULL
+) DEFAULT CHARSET=utf8;
+
+create  algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
+          FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
+
+UPDATE t2 
+SET data_entry_cost
+  = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
+	FROM 
+        v1 AS query 
+        WHERE data_entry_exit_id = t2.data_entry_id
+      )
+    );
+
+UPDATE t2 
+SET data_entry_cost
+  = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
+	FROM 
+        ( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
+          FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query 
+        WHERE data_entry_exit_id = t2.data_entry_id
+      )
+    );
+
+drop view v1;
+drop table t1, t2; 
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index fe04cdf..815be87 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5445,6 +5445,41 @@ EXECUTE stmt;
 DROP TABLE t1, t2, t3;
 DROP VIEW v3;
 
+--echo #
+--echo # MDEV-8632: Segmentation fault on INSERT
+--echo #
+CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL,
+  `r` float NOT NULL,
+  PRIMARY KEY (`id`)
+) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+create view v1 as select id, if(r=r,1,2) as d from t1;
+create view v2 as
+  select id, 
+  d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+  from v1;
+insert into t1 (id, r)
+select id,p from
+(
+  select id, 
+  d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
+  from (
+    select id, if(r=r,1,2) as d
+    from t1
+  ) a
+) b
+on duplicate key update r=p;
+insert into t1 (id, r)
+select id,p from v2 
+on duplicate key update r=p;
+
+prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
+execute stmt;
+execute stmt;
+deallocate prepare stmt;
+
+drop view v1,v2;
+drop table `t1`;
 --echo # -----------------------------------------------------------------
 --echo # -- End of 5.5 tests.
 --echo # -----------------------------------------------------------------
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index dd16e53..425a2b1 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -1,6 +1,6 @@
 /*
    Copyright (c) 2002, 2013, Oracle and/or its affiliates
-   Copyright (c) 2009, 2013, Monty Program Ab
+   Copyright (c) 2009, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/packaging/rpm-oel/mysql.spec.in b/packaging/rpm-oel/mysql.spec.in
index bb232fb..a76eaa1 100644
--- a/packaging/rpm-oel/mysql.spec.in
+++ b/packaging/rpm-oel/mysql.spec.in
@@ -301,6 +301,7 @@ Obsoletes:      mysql-devel < %{version}-%{release}
 Obsoletes:      mariadb-devel
 Provides:       mysql-devel = %{version}-%{release}
 Provides:       mysql-devel%{?_isa} = %{version}-%{release}
+Conflicts:      mysql-connector-c-devel < 6.2
 
 %description    devel
 This package contains the development header files and libraries necessary
@@ -323,6 +324,7 @@ Obsoletes:      mysql-libs < %{version}-%{release}
 Obsoletes:      mariadb-libs
 Provides:       mysql-libs = %{version}-%{release}
 Provides:       mysql-libs%{?_isa} = %{version}-%{release}
+Conflicts:      mysql-connector-c-shared < 6.2
 
 %description    libs
 This package contains the shared libraries for MySQL client
@@ -620,7 +622,7 @@ rm -r $(readlink var) var
 
 %pre server
 /usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
-/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
+/usr/sbin/useradd -M %{!?el5:-N} -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
     -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
 
 %post server
@@ -913,6 +915,9 @@ fi
 %endif
 
 %changelog
+* Tue Sep 29 2015 Balasubramanian Kandasamy <balasubramanian.kandasamy at oracle.com> - 5.5.47-1
+- Added conflicts to mysql-connector-c-shared dependencies
+
 * Tue Jul 22 2014 Balasubramanian Kandasamy <balasubramanian.kandasamy at oracle.com> - 5.5.39-5
 - Provide mysql-compat-server dependencies
 
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index 09b81ca..35376a8 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights
+   reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,7 +47,6 @@ pthread_handler_t mysql_heartbeat(void *p)
   DBUG_ENTER("mysql_heartbeat");
   struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p;
   char buffer[HEART_STRING_BUFFER];
-  unsigned int x= 0;
   time_t result;
   struct tm tm_tmp;
 
@@ -65,7 +65,6 @@ pthread_handler_t mysql_heartbeat(void *p)
                 tm_tmp.tm_min,
                 tm_tmp.tm_sec);
     my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
-    x++;
   }
 
   DBUG_RETURN(0);
@@ -174,6 +173,13 @@ static int daemon_example_plugin_deinit(void *p __attribute__ ((unused)))
               tm_tmp.tm_min,
               tm_tmp.tm_sec);
   my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
+
+  /*
+    Need to wait for the hearbeat thread to terminate before closing
+    the file it writes to and freeing the memory it uses.
+  */
+  pthread_join(con->heartbeat_thread, NULL);
+
   my_close(con->heartbeat_file, MYF(0));
 
   my_free(con);
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 9bf2fcb..a06c0e6 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -22,6 +22,10 @@ extern ST_SCHEMA_TABLE schema_tables[];
 
 namespace feedback {
 
+#ifndef DBUG_OFF
+ulong debug_startup_interval, debug_first_interval, debug_interval;
+#endif
+
 char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here
 
 /* backing store for system variables */
@@ -249,6 +253,18 @@ static int init(void *p)
 
   prepare_linux_info();
 
+#ifndef DBUG_OFF
+  if (startup_interval != debug_startup_interval ||
+      first_interval != debug_first_interval ||
+      interval != debug_interval)
+  {
+    startup_interval= debug_startup_interval;
+    first_interval= debug_first_interval;
+    interval= debug_interval;
+    user_info= const_cast<char*>("mysql-test");
+  }
+#endif
+
   url_count= 0;
   if (*url)
   {
@@ -347,12 +363,29 @@ static MYSQL_SYSVAR_ULONG(send_retry_wait, send_retry_wait, PLUGIN_VAR_RQCMDARG,
        "Wait this many seconds before retrying a failed send.",
        NULL, NULL, 60, 1, 60*60*24, 1);
 
+#ifndef DBUG_OFF
+static MYSQL_SYSVAR_ULONG(debug_startup_interval, debug_startup_interval,
+       PLUGIN_VAR_RQCMDARG, "for debugging only",
+       NULL, NULL, startup_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_first_interval, debug_first_interval,
+       PLUGIN_VAR_RQCMDARG, "for debugging only",
+       NULL, NULL, first_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval,
+       PLUGIN_VAR_RQCMDARG, "for debugging only",
+       NULL, NULL, interval, 1, INT_MAX32, 1);
+#endif
+
 static struct st_mysql_sys_var* settings[] = {
   MYSQL_SYSVAR(server_uid),
   MYSQL_SYSVAR(user_info),
   MYSQL_SYSVAR(url),
   MYSQL_SYSVAR(send_timeout),
   MYSQL_SYSVAR(send_retry_wait),
+#ifndef DBUG_OFF
+  MYSQL_SYSVAR(debug_startup_interval),
+  MYSQL_SYSVAR(debug_first_interval),
+  MYSQL_SYSVAR(debug_interval),
+#endif
   NULL
 };
 
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index c5acbb5..98939c2 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -58,6 +58,10 @@ class Url {
 extern Url **urls;
 extern uint url_count;
 
+extern ulong startup_interval;
+extern ulong first_interval;
+extern ulong interval;
+
 /* these are used to communicate with the background thread */
 extern mysql_mutex_t sleep_mutex;
 extern mysql_cond_t sleep_condition;
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 4ab4599..da7628e 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
 
 static size_t needed_size= 20480;
 
-static const time_t startup_interval= 60*5;     ///< in seconds (5 minutes)
-static const time_t first_interval= 60*60*24;   ///< in seconds (one day)
-static const time_t interval= 60*60*24*7;       ///< in seconds (one week)
+ulong startup_interval= 60*5;     ///< in seconds (5 minutes)
+ulong first_interval= 60*60*24;   ///< in seconds (one day)
+ulong interval= 60*60*24*7;       ///< in seconds (one week)
 
 /**
   reads the rows from a table and puts them, concatenated, in a String
@@ -124,6 +124,7 @@ static int prepare_for_fill(TABLE_LIST *tables)
   if (!tables->table)
     return 1;
 
+  tables->select_lex= thd->lex->current_select;
   tables->table->pos_in_table_list= tables;
 
   return 0;
@@ -253,6 +254,7 @@ ret:
   {
     if (tables.table)
       free_tmp_table(thd, tables.table);
+    thd->cleanup_after_query();
     /*
       clean up, free the thd.
       reset all thread local status variables to minimize
diff --git a/regex/main.c b/regex/main.c
index f5b5919..d35d5a9 100644
--- a/regex/main.c
+++ b/regex/main.c
@@ -425,7 +425,8 @@ char *should;
 				(sub.rm_so != -1 && sub.rm_eo == -1) ||
 				(sub.rm_so != -1 && sub.rm_so < 0) ||
 				(sub.rm_eo != -1 && sub.rm_eo < 0) ) {
-		sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
+		snprintf(grump, sizeof(grump),
+			 "start %ld end %ld", (long)sub.rm_so,
 							(long)sub.rm_eo);
 		return(grump);
 	}
@@ -438,7 +439,8 @@ char *should;
 
 	/* check for in range */
 	if ((int) sub.rm_eo > (int) strlen(str)) {
-		sprintf(grump, "start %ld end %ld, past end of string",
+		snprintf(grump, sizeof(grump),
+			 "start %ld end %ld, past end of string",
 					(long)sub.rm_so, (long)sub.rm_eo);
 		return(grump);
 	}
@@ -449,13 +451,15 @@ char *should;
 
 	/* check for not supposed to match */
 	if (should == NULL) {
-		sprintf(grump, "matched `%.*s'", len, p);
+		snprintf(grump, sizeof(grump),
+			 "matched `%.*s'", len, p);
 		return(grump);
 	}
 
 	/* check for wrong match */
 	if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
-		sprintf(grump, "matched `%.*s' instead", len, p);
+		snprintf(grump, sizeof(grump),
+			 "matched `%.*s' instead", len, p);
 		return(grump);
 	}
 	if (shlen > 0)
@@ -468,7 +472,8 @@ char *should;
 	if (shlen == 0)
 		shlen = 1;	/* force check for end-of-string */
 	if (strncmp(p, at, shlen) != 0) {
-		sprintf(grump, "matched null at `%.20s'", p);
+		snprintf(grump, sizeof(grump),
+			 "matched null at `%.20s'", p);
 		return(grump);
 	}
 	return(NULL);
@@ -501,7 +506,7 @@ char *name;
 	static char efbuf[100];
 	my_regex_t re;
 
-	sprintf(efbuf, "REG_%s", name);
+	snprintf(efbuf, sizeof(efbuf), "REG_%s", name);
 	assert(strlen(efbuf) < sizeof(efbuf));
 	re.re_endp = efbuf;
 	(void) my_regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index cd1b6fc..2f67ff4 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -486,6 +486,7 @@ sub get_mysqladmin_options
 
 # Return a list of option files which can be opened.  Similar, but not
 # identical, to behavior of my_search_option_files()
+# TODO implement and use my_print_defaults --list-groups instead
 sub list_defaults_files
 {
   my %opt;
@@ -497,9 +498,7 @@ sub list_defaults_files
 
   return ($opt{file}) if exists $opt{file};
 
-  my %seen;  # Don't list the same file more than once
-  return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ }
-              ('/etc/my.cnf',
+  return      ('/etc/my.cnf',
                '/etc/mysql/my.cnf',
                '@sysconfdir@/my.cnf',
                ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
@@ -539,11 +538,12 @@ sub find_groups
     }
   }
 
+  my %seen;
   my @defaults_files = list_defaults_files();
-  #warn "@{[sort keys %gids]} -> @defaults_files\n";
-  foreach my $file (@defaults_files)
+  while (@defaults_files)
   {
-    next unless open CONF, "< $file";
+    my $file = shift @defaults_files;
+    next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
 
     while (<CONF>)
     {
@@ -556,6 +556,14 @@ sub find_groups
           push @groups, "$1$2";
         }
       }
+      elsif (/^\s*!include\s+(\S.*?)\s*$/)
+      {
+        push @defaults_files, $1;
+      }
+      elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
+      {
+        push @defaults_files, <$1/*.cnf>;
+      }
     }
 
     close CONF;
diff --git a/sql-common/client.c b/sql-common/client.c
index 01f7397..1bb4a25 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1885,8 +1885,11 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
 {
   SSL *ssl;
   X509 *server_cert;
-  char *cp1, *cp2;
-  char *buf;
+  X509_NAME *x509sn;
+  int cn_pos;
+  X509_NAME_ENTRY *cn_entry;
+  ASN1_STRING *cn_asn1;
+  const char *cn_str;
   DBUG_ENTER("ssl_verify_server_cert");
   DBUG_PRINT("enter", ("server_hostname: %s", server_hostname));
 
@@ -1920,34 +1923,32 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c
     are what we expect.
   */
 
-  buf= X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0);
-  X509_free (server_cert);
+  x509sn= X509_get_subject_name(server_cert);
 
-  if (!buf)
-  {
-    *errptr= "Out of memory";
-    DBUG_RETURN(1);
-  }
+  if ((cn_pos= X509_NAME_get_index_by_NID(x509sn, NID_commonName, -1)) < 0)
+    goto err;
 
-  DBUG_PRINT("info", ("hostname in cert: %s", buf));
-  cp1= strstr(buf, "/CN=");
-  if (cp1)
-  {
-    cp1+= 4; /* Skip the "/CN=" that we found */
-    /* Search for next / which might be the delimiter for email */
-    cp2= strchr(cp1, '/');
-    if (cp2)
-      *cp2= '\0';
-    DBUG_PRINT("info", ("Server hostname in cert: %s", cp1));
-    if (!strcmp(cp1, server_hostname))
-    {
-      free(buf);
-      /* Success */
-      DBUG_RETURN(0);
-    }
-  }
+  if (!(cn_entry= X509_NAME_get_entry(x509sn, cn_pos)))
+    goto err;
+
+  if (!(cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry)))
+    goto err;
+
+  cn_str = (char *)ASN1_STRING_data(cn_asn1);
+
+  /* Make sure there is no embedded \0 in the CN */
+  if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(cn_str))
+    goto err;
+
+  if (strcmp(cn_str, server_hostname))
+    goto err;
+
+  X509_free (server_cert);
+  DBUG_RETURN(0);
+
+err:
+  X509_free(server_cert);
   *errptr= "SSL certificate validation failure";
-  free(buf);
   DBUG_RETURN(1);
 }
 
diff --git a/sql/field.h b/sql/field.h
index b20bedb..4c79847 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -349,7 +349,7 @@ public:
     DBUG_ENTER("Field::pack_length_from_metadata");
     DBUG_RETURN(field_metadata);
   }
-  virtual uint row_pack_length() { return 0; }
+  virtual uint row_pack_length() const { return 0; }
   virtual int save_field_metadata(uchar *first_byte)
   { return do_save_field_metadata(first_byte); }
 
@@ -757,7 +757,7 @@ public:
   int store_decimal(const my_decimal *);
   my_decimal *val_decimal(my_decimal *);
   uint is_equal(Create_field *new_field);
-  uint row_pack_length() { return pack_length(); }
+  uint row_pack_length() const { return pack_length(); }
   uint32 pack_length_from_metadata(uint field_metadata) {
     uint32 length= pack_length();
     DBUG_PRINT("result", ("pack_length_from_metadata(%d): %u",
@@ -940,7 +940,7 @@ public:
   uint size_of() const { return sizeof(*this); } 
   uint32 pack_length() const { return (uint32) bin_size; }
   uint pack_length_from_metadata(uint field_metadata);
-  uint row_pack_length() { return pack_length(); }
+  uint row_pack_length() const { return pack_length(); }
   bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
                              uint16 mflags, int *order_var);
   uint is_equal(Create_field *new_field);
@@ -1189,7 +1189,7 @@ public:
   int cmp(const uchar *,const uchar *);
   void sort_string(uchar *buff,uint length);
   uint32 pack_length() const { return sizeof(float); }
-  uint row_pack_length() { return pack_length(); }
+  uint row_pack_length() const { return pack_length(); }
   void sql_type(String &str) const;
 private:
   int do_save_field_metadata(uchar *first_byte);
@@ -1229,7 +1229,7 @@ public:
   int cmp(const uchar *,const uchar *);
   void sort_string(uchar *buff,uint length);
   uint32 pack_length() const { return sizeof(double); }
-  uint row_pack_length() { return pack_length(); }
+  uint row_pack_length() const { return pack_length(); }
   void sql_type(String &str) const;
 private:
   int do_save_field_metadata(uchar *first_byte);
@@ -1718,7 +1718,7 @@ public:
   }
   bool compatible_field_size(uint field_metadata, Relay_log_info *rli,
                              uint16 mflags, int *order_var);
-  uint row_pack_length() { return field_length; }
+  uint row_pack_length() const { return field_length; }
   int pack_cmp(const uchar *a,const uchar *b,uint key_length,
                bool insert_or_update);
   int pack_cmp(const uchar *b,uint key_length,bool insert_or_update);
@@ -1768,7 +1768,7 @@ public:
   enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
   bool match_collation_to_optimize_range() const { return TRUE; }
   enum ha_base_keytype key_type() const;
-  uint row_pack_length() { return field_length; }
+  uint row_pack_length() const { return field_length; }
   bool zero_pack() const { return 0; }
   int  reset(void) { bzero(ptr,field_length+length_bytes); return 0; }
   uint32 pack_length() const { return (uint32) field_length+length_bytes; }
@@ -1893,7 +1893,7 @@ public:
   */
   uint32 pack_length_no_ptr() const
   { return (uint32) (packlength); }
-  uint row_pack_length() { return pack_length_no_ptr(); }
+  uint row_pack_length() const { return pack_length_no_ptr(); }
   uint32 sort_length() const;
   virtual uint32 max_data_length() const
   {
@@ -2055,7 +2055,7 @@ public:
   enum_field_types real_type() const { return MYSQL_TYPE_ENUM; }
   uint pack_length_from_metadata(uint field_metadata)
   { return (field_metadata & 0x00ff); }
-  uint row_pack_length() { return pack_length(); }
+  uint row_pack_length() const { return pack_length(); }
   virtual bool zero_pack() const { return 0; }
   bool optimize_range(uint idx, uint part) { return 0; }
   bool eq_def(Field *field);
@@ -2176,7 +2176,7 @@ public:
   uint32 pack_length() const { return (uint32) (field_length + 7) / 8; }
   uint32 pack_length_in_rec() const { return bytes_in_rec; }
   uint pack_length_from_metadata(uint field_metadata);
-  uint row_pack_length()
+  uint row_pack_length() const
   { return (bytes_in_rec + ((bit_len > 0) ? 1 : 0)); }
   bool compatible_field_size(uint metadata, Relay_log_info *rli,
                              uint16 mflags, int *order_var);
diff --git a/sql/item.cc b/sql/item.cc
index 878c960..6d2983f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1891,6 +1891,8 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
     */
     Item_aggregate_ref *item_ref;
     uint el= fields.elements;
+    DBUG_ASSERT(fields.elements <=
+                thd->lex->current_select->ref_pointer_array_size);
     /*
       If this is an item_ref, get the original item
       This is a safety measure if this is called for things that is
@@ -4887,8 +4889,24 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
             As this is an outer field it should be added to the list of
             non aggregated fields of the outer select.
           */
-          marker= select->cur_pos_in_select_list;
-          select->join->non_agg_fields.push_back(this);
+          if (select->join)
+          {
+            marker= select->cur_pos_in_select_list;
+            select->join->non_agg_fields.push_back(this);
+          }
+          else
+          {
+            /*
+              join is absent if it is upper SELECT_LEX of non-select
+              command
+            */
+            DBUG_ASSERT(select->master_unit()->outer_select() == NULL &&
+                        (thd->lex->sql_command != SQLCOM_SELECT &&
+                         thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
+                         thd->lex->sql_command != SQLCOM_DELETE_MULTI &&
+                         thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
+                         thd->lex->sql_command != SQLCOM_REPLACE_SELECT));
+          }
         }
         if (*from_field != view_ref_found)
         {
@@ -6719,6 +6737,7 @@ Item *Item_field::update_value_transformer(uchar *select_arg)
   {
     List<Item> *all_fields= &select->join->all_fields;
     Item **ref_pointer_array= select->ref_pointer_array;
+    DBUG_ASSERT(all_fields->elements <= select->ref_pointer_array_size);
     int el= all_fields->elements;
     Item_ref *ref;
 
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 0c48592..d5f5087 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,5 +1,5 @@
 /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2009, 2013, Monty Program Ab.
+   Copyright (c) 2009, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 9504be5..babe1d7 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1,7 +1,7 @@
 #ifndef ITEM_CMPFUNC_INCLUDED
 #define ITEM_CMPFUNC_INCLUDED
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
-   Copyright (c) 2009, 2011, Monty Program Ab.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
+   Copyright (c) 2009, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/sql/item_func.cc b/sql/item_func.cc
index eb5b63f..252ca9e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
    Copyright (c) 2009, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
@@ -719,7 +719,7 @@ void Item_func::count_real_length()
 bool Item_func::count_string_result_length(enum_field_types field_type,
                                            Item **items, uint nitems)
 {
-  if (agg_arg_charsets(collation, items, nitems, MY_COLL_ALLOW_CONV, 1))
+  if (agg_arg_charsets_for_string_result(collation, items, nitems, 1))
     return true;
   if (is_temporal_type(field_type))
     count_datetime_length(items, nitems);
@@ -6280,9 +6280,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
   table= 0;
   for (uint i=1 ; i < arg_count ; i++)
   {
-    item=args[i];
-    if (item->type() == Item::REF_ITEM)
-      args[i]= item= *((Item_ref *)item)->ref;
+    item= args[i]= args[i]->real_item();
     /*
       When running in PS mode, some Item_field's can already be replaced
       to Item_func_conv_charset during PREPARE time. This is possible
@@ -6295,7 +6293,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
     if (!thd->stmt_arena->is_stmt_execute() &&
         item->type() != Item::FIELD_ITEM)
     {
-      my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
+      my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
       return TRUE;
     }
     /*
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 1107945..3020faf 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
-   Copyright (c) 2010, 2012, Monty Program Ab
+/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1748,6 +1748,27 @@ Item_in_subselect::single_value_transformer(JOIN *join)
       runtime created Ref item which is deleted at the end
       of the statement. Thus one of 'substitution' arguments
       can be broken in case of PS.
+
+      @todo
+      Why do we use real_item()/substitutional_item() instead of the plain
+      left_expr?
+      Because left_expr might be a rollbackable item, and we fail to properly
+      rollback all copies of left_expr at end of execution, so we want to
+      avoid creating copies of left_expr as much as possible, so we use
+      real_item() instead.
+      Doing a proper rollback is difficult: the change was registered for the
+      original item which was the left argument of IN. Then this item was
+      copied to left_expr, which is copied below to substitution->args[0]. To
+      do a proper rollback, we would have to restore the content
+      of both copies as well as the original item. There might be more copies,
+      if AND items have been constructed.
+      The same applies to the right expression.
+      However, using real_item()/substitutional_item() brings its own
+      problems: for example, we lose information that the item is an outer
+      reference; the item can thus wrongly be considered for a Keyuse (causing
+      bug#17766653).
+      When WL#6570 removes the "rolling back" system, all
+      real_item()/substitutional_item() in this file should be removed.
     */ 
     substitution= func->create(left_expr, where_item);
     have_to_be_excluded= 1;
@@ -2034,6 +2055,9 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join,
   }
   else
   {
+    /*
+      Grep for "WL#6570" to see the relevant comment about real_item.
+    */
     Item *item= (Item*) select_lex->item_list.head()->real_item();
 
     if (select_lex->table_list.elements)
diff --git a/sql/log.cc b/sql/log.cc
index 0940cb9..a87ec72 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -6296,11 +6296,13 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd,
   int ret= 0;
   DBUG_ENTER("wait_for_update_bin_log");
 
+  thd_wait_begin(thd, THD_WAIT_BINLOG);
   if (!timeout)
     mysql_cond_wait(&update_cond, &LOCK_log);
   else
     ret= mysql_cond_timedwait(&update_cond, &LOCK_log,
                               const_cast<struct timespec *>(timeout));
+  thd_wait_end(thd);
   DBUG_RETURN(ret);
 }
 
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3ad7b84..6a14b5c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1813,14 +1813,9 @@ void clean_up(bool print_message)
   item_user_lock_free();
   lex_free();				/* Free some memory */
   item_create_cleanup();
-  if (!opt_noacl)
-  {
-#ifdef HAVE_DLOPEN
-    udf_free();
-#endif
-  }
   table_def_start_shutdown();
   plugin_shutdown();
+  udf_free();
   ha_end();
   if (tc_log)
     tc_log->close();
@@ -5005,12 +5000,7 @@ int mysqld_main(int argc, char **argv)
   if (!opt_bootstrap)
     servers_init(0);
 
-  if (!opt_noacl)
-  {
-#ifdef HAVE_DLOPEN
-    udf_init();
-#endif
-  }
+  udf_init();
 
   init_status_vars();
   if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 3480d02..24ae9ec 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -336,6 +337,7 @@ extern mysql_mutex_t
        LOCK_prepared_stmt_count, LOCK_error_messages, LOCK_connection_count;
 extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_thread_count;
 #ifdef HAVE_OPENSSL
+extern char* des_key_file;
 extern mysql_mutex_t LOCK_des_key_file;
 #endif
 extern mysql_mutex_t LOCK_server_started;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 4588c74..da7c3f1 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7326,6 +7326,8 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
     DBUG_RETURN(FALSE);
   }
 
+  mysql_mutex_lock(&acl_cache->lock);
+
   /* check for matching WITH PROXY rights */
   for (uint i=0; i < acl_proxy_users.elements; i++)
   {
@@ -7338,10 +7340,12 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
         proxy->get_with_grant())
     {
       DBUG_PRINT("info", ("found"));
+      mysql_mutex_unlock(&acl_cache->lock);
       DBUG_RETURN(FALSE);
     }
   }
 
+  mysql_mutex_unlock(&acl_cache->lock);
   my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0),
            thd->security_ctx->user,
            thd->security_ctx->host_or_ip);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 640ee5d..52e059b 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1999,7 +1999,7 @@ public:
   */
   MDL_request grl_protection;
 
-  Delayed_insert()
+  Delayed_insert(SELECT_LEX *current_select)
     :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
      status(0), handler_thread_initialized(FALSE), group_count(0)
   {
@@ -2009,7 +2009,7 @@ public:
     strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
     thd.current_tablenr=0;
     thd.command=COM_DELAYED_INSERT;
-    thd.lex->current_select= 0; 		// for my_message_sql
+    thd.lex->current_select= current_select;
     thd.lex->sql_command= SQLCOM_INSERT;        // For innodb::store_lock()
     /*
       Prevent changes to global.lock_wait_timeout from affecting
@@ -2186,7 +2186,7 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
     */
     if (! (di= find_handler(thd, table_list)))
     {
-      if (!(di= new Delayed_insert()))
+      if (!(di= new Delayed_insert(thd->lex->current_select)))
         goto end_create;
       mysql_mutex_lock(&LOCK_thread_count);
       thread_count++;
@@ -2817,6 +2817,16 @@ pthread_handler_t handle_delayed_insert(void *arg)
     if (di->open_and_lock_table())
       goto err;
 
+    /*
+      INSERT DELAYED generally expects thd->lex->current_select to be NULL,
+      since this is not an attribute of the current thread. This can lead to
+      problems if the thread that spawned the current one disconnects.
+      current_select will then point to freed memory. But current_select is
+      required to resolve the partition function. So, after fulfilling that
+      requirement, we set the current_select to 0.
+    */
+    thd->lex->current_select= NULL;
+
     /* Tell client that the thread is initialized */
     mysql_cond_signal(&di->cond_client);
 
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 9ccafa7..957764c 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -545,6 +545,16 @@ void lex_end(LEX *lex)
   DBUG_ENTER("lex_end");
   DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex));
 
+  lex_end_stage1(lex);
+  lex_end_stage2(lex);
+
+  DBUG_VOID_RETURN;
+}
+
+void lex_end_stage1(LEX *lex)
+{
+  DBUG_ENTER("lex_end_stage1");
+
   /* release used plugins */
   if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
   {
@@ -556,6 +566,19 @@ void lex_end(LEX *lex)
   delete lex->sphead;
   lex->sphead= NULL;
 
+  DBUG_VOID_RETURN;
+}
+
+/*
+  MASTER INFO parameters (or state) is normally cleared towards the end
+  of a statement. But in case of PS, the state needs to be preserved during
+  its lifetime and should only be cleared on PS close or deallocation.
+*/
+void lex_end_stage2(LEX *lex)
+{
+  DBUG_ENTER("lex_end_stage2");
+
+  /* Reset LEX_MASTER_INFO */
   lex->mi.reset();
 
   DBUG_VOID_RETURN;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index aa59d76..6454da2 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2940,6 +2940,8 @@ extern void lex_init(void);
 extern void lex_free(void);
 extern void lex_start(THD *thd);
 extern void lex_end(LEX *lex);
+extern void lex_end_stage1(LEX *lex);
+extern void lex_end_stage2(LEX *lex);
 void end_lex_with_single_table(THD *thd, TABLE *table, LEX *old_lex);
 int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex);
 extern int MYSQLlex(union YYSTYPE *yylval, THD *thd);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e948813..6727b2a 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2013, Oracle and/or its affiliates.
-   Copyright (c) 2008, 2013, Monty Program Ab
+/* Copyright (c) 2002, 2015, Oracle and/or its affiliates.
+   Copyright (c) 2008, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1408,7 +1408,8 @@ static int mysql_test_update(Prepared_statement *stmt,
     (SELECT_ACL & ~table_list->table->grant.privilege);
   table_list->register_want_access(SELECT_ACL);
 #endif
-  if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0))
+  if (setup_fields(thd, 0, stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0) ||
+      check_unique_table(thd, table_list))
     goto error;
   /* TODO: here we should send types of placeholders to the client. */
   DBUG_RETURN(0);
@@ -3416,7 +3417,8 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
     thd->mdl_context.release_transactional_locks();
   }
 
-  lex_end(lex);
+  /* Preserve CHANGE MASTER attributes */
+  lex_end_stage1(lex);
   cleanup_stmt();
   thd->restore_backup_statement(this, &stmt_backup);
   thd->stmt_arena= old_stmt_arena;
@@ -3779,8 +3781,8 @@ Prepared_statement::swap_prepared_statement(Prepared_statement *copy)
   swap_variables(LEX_STRING, name, copy->name);
   /* Ditto */
   swap_variables(char *, db, copy->db);
+  swap_variables(size_t, db_length, copy->db_length);
 
-  DBUG_ASSERT(db_length == copy->db_length);
   DBUG_ASSERT(param_count == copy->param_count);
   DBUG_ASSERT(thd == copy->thd);
   last_error[0]= '\0';
@@ -3997,6 +3999,10 @@ void Prepared_statement::deallocate()
 {
   /* We account deallocate in the same manner as mysqld_stmt_close */
   status_var_increment(thd->status_var.com_stmt_close);
+
+  /* It should now be safe to reset CHANGE MASTER parameters */
+  lex_end_stage2(lex);
+
   /* Statement map calls delete stmt on erase */
   thd->stmt_map.erase(this);
 }
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 914b902..b9328ad 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@
 #include "sql_repl.h"    // reset_master, reset_slave
 #include "rpl_mi.h"      // Master_info::data_lock
 #include "debug_sync.h"
+#include "des_key_file.h"
 
 static void disable_checkpoints(THD *thd);
 
@@ -301,7 +302,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long options,
     }
   }
 #endif
-#ifdef OPENSSL
+#ifdef HAVE_OPENSSL
    if (options & REFRESH_DES_KEY_FILE)
    {
      if (des_key_file && load_des_key_file(des_key_file))
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e960a3d..1b14640 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -427,6 +427,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
     if (ref_pointer_array && !ref->found_in_select_list)
     {
       int el= all_fields.elements;
+      DBUG_ASSERT(all_fields.elements <= select->ref_pointer_array_size);
       ref_pointer_array[el]= item;
       /* Add the field item to the select list of the current select. */
       all_fields.push_front(item);
@@ -832,6 +833,7 @@ JOIN::prepare(Item ***rref_pointer_array,
       {
         Item_field *field= new Item_field(thd, *(Item_field**)ord->item);
         int el= all_fields.elements;
+        DBUG_ASSERT(all_fields.elements <= select_lex->ref_pointer_array_size);
         ref_pointer_array[el]= field;
         all_fields.push_front(field);
         ord->item= ref_pointer_array + el;
@@ -4112,6 +4114,17 @@ add_key_field(JOIN *join,
               Field *field, bool eq_func, Item **value, uint num_values,
               table_map usable_tables, SARGABLE_PARAM **sargables)
 {
+  if (field->table->reginfo.join_tab == NULL)
+  {
+    /*
+       Due to a bug in IN-to-EXISTS (grep for real_item() in item_subselect.cc
+       for more info), an index over a field from an outer query might be
+       considered here, which is incorrect. Their query has been fully
+       optimized already so their reginfo.join_tab is NULL and we reject them.
+    */
+    return;
+  }
+
   uint optimize= 0;  
   if (eq_func &&
       ((join->is_allowed_hash_join_access() &&
@@ -14902,8 +14915,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
   uint  temp_pool_slot=MY_BIT_NONE;
   uint fieldnr= 0;
   ulong reclength, string_total_length;
-  bool  using_unique_constraint= 0;
-  bool  use_packed_rows= 0;
+  bool  using_unique_constraint= false;
+  bool  use_packed_rows= false;
   bool  not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
   char  *tmpname,path[FN_REFLEN];
   uchar	*pos, *group_buff, *bitmaps;
@@ -14977,10 +14990,10 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
       */
       (*tmp->item)->marker=4;			// Store null in key
       if ((*tmp->item)->too_big_for_varchar())
-	using_unique_constraint=1;
+	using_unique_constraint= true;
     }
     if (param->group_length >= MAX_BLOB_WIDTH)
-      using_unique_constraint=1;
+      using_unique_constraint= true;
     if (group)
       distinct=0;				// Can't use distinct
   }
@@ -15234,12 +15247,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
         *blob_field++= fieldnr;
 	blob_count++;
       }
+
       if (new_field->real_type() == MYSQL_TYPE_STRING ||
           new_field->real_type() == MYSQL_TYPE_VARCHAR)
       {
         string_count++;
         string_total_length+= new_field->pack_length();
       }
+
       if (item->marker == 4 && item->maybe_null)
       {
 	group_null_items++;
@@ -15292,7 +15307,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
     if (group &&
 	(param->group_parts > table->file->max_key_parts() ||
 	 param->group_length > table->file->max_key_length()))
-      using_unique_constraint=1;
+      using_unique_constraint= true;
   }
   else
   {
@@ -15429,7 +15444,9 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
              field->real_type() == MYSQL_TYPE_STRING &&
 	     length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
       recinfo->type= FIELD_SKIP_ENDSPACE;
-    else if (field->real_type() == MYSQL_TYPE_VARCHAR)
+    else if (use_packed_rows &&
+             field->real_type() == MYSQL_TYPE_VARCHAR &&
+             length >= MIN_STRING_LENGTH_TO_PACK_ROWS)
       recinfo->type= FIELD_VARCHAR;
     else
       recinfo->type= FIELD_NORMAL;
@@ -16200,7 +16217,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
 		       start_recinfo,
 		       share->uniques, &uniquedef,
 		       &create_info,
-		       HA_CREATE_TMP_TABLE)))
+                       HA_CREATE_TMP_TABLE |
+                       ((share->db_create_options & HA_OPTION_PACK_RECORD) ?
+                        HA_PACK_RECORD : 0)
+                      )))
   {
     table->file->print_error(error,MYF(0));	/* purecov: inspected */
     table->db_stat=0;
@@ -20596,6 +20616,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
     return TRUE; /* Wrong field. */
 
   uint el= all_fields.elements;
+  DBUG_ASSERT(all_fields.elements <=
+              thd->lex->current_select->ref_pointer_array_size);
   all_fields.push_front(order_item); /* Add new field to field list. */
   ref_pointer_array[el]= order_item;
   /*
@@ -20855,6 +20877,8 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
         */
         Item_field *new_item= new Item_field(thd, (Item_field*)item);
         int el= all_fields.elements;
+        DBUG_ASSERT(all_fields.elements <=
+                    thd->lex->current_select->ref_pointer_array_size);
         orig_ref_pointer_array[el]= new_item;
         all_fields.push_front(new_item);
         ord->item= orig_ref_pointer_array + el;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 86fc11c..45bddc2 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7371,11 +7371,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
   tmp_table_param->field_count= field_count;
   tmp_table_param->schema_table= 1;
   SELECT_LEX *select_lex= thd->lex->current_select;
+  bool keep_row_order= sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND;
   if (!(table= create_tmp_table(thd, tmp_table_param,
                                 field_list, (ORDER*) 0, 0, 0, 
                                 (select_lex->options | thd->variables.option_bits |
-                                 TMP_TABLE_ALL_COLUMNS),
-                                HA_POS_ERROR, table_list->alias)))
+                                 TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR,
+                                table_list->alias, false, keep_row_order)))
     DBUG_RETURN(0);
   my_bitmap_map* bitmaps=
     (my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6e589e2..a771f64 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2986,9 +2986,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
                                                sql_field->interval_list);
         List_iterator<String> int_it(sql_field->interval_list);
         String conv, *tmp;
-        char comma_buf[4]; /* 4 bytes for utf32 */
+        char comma_buf[5]; /* 5 bytes for 'filename' charset */
+        DBUG_ASSERT(sizeof(comma_buf) >= cs->mbmaxlen);
         int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
-                                          (uchar*) comma_buf + 
+                                          (uchar*) comma_buf +
                                           sizeof(comma_buf));
         DBUG_ASSERT(comma_length > 0);
         for (uint i= 0; (tmp= int_it++); i++)
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index e5fac48..626e556 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -142,7 +142,7 @@ void udf_init()
   DBUG_ENTER("ufd_init");
   char db[]= "mysql"; /* A subject to casednstr, can't be constant */
 
-  if (initialized)
+  if (initialized || opt_noacl)
     DBUG_VOID_RETURN;
 
 #ifdef HAVE_PSI_INTERFACE
@@ -267,6 +267,8 @@ void udf_free()
 {
   /* close all shared libraries */
   DBUG_ENTER("udf_free");
+  if (opt_noacl)
+    DBUG_VOID_RETURN;
   for (uint idx=0 ; idx < udf_hash.records ; idx++)
   {
     udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx);
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index cdb15b9..68c0196 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -143,5 +143,8 @@ udf_func *find_udf(const char *name, uint len=0,bool mark_used=0);
 void free_udf(udf_func *udf);
 int mysql_create_function(THD *thd,udf_func *udf);
 int mysql_drop_function(THD *thd,const LEX_STRING *name);
+#else
+static inline void udf_init(void) { }
+static inline void udf_free(void) { }
 #endif
 #endif /* SQL_UDF_INCLUDED */
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 23e17b0..c8a7990 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -367,6 +367,9 @@ int mysql_update(THD *thd,
     DBUG_RETURN(1);				/* purecov: inspected */
   }
 
+  if (check_unique_table(thd, table_list))
+    DBUG_RETURN(TRUE);
+
   /* Apply the IN=>EXISTS transformation to all subqueries and optimize them. */
   if (select_lex->optimize_unflattened_subqueries(false))
     DBUG_RETURN(TRUE);
@@ -1036,19 +1039,30 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
       setup_ftfuncs(select_lex))
     DBUG_RETURN(TRUE);
 
-  /* Check that we are not using table that we are updating in a sub select */
-  {
-    TABLE_LIST *duplicate;
-    if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
-    {
-      update_non_unique_table_error(table_list, "UPDATE", duplicate);
-      DBUG_RETURN(TRUE);
-    }
-  }
   select_lex->fix_prepare_information(thd, conds, &fake_conds);
   DBUG_RETURN(FALSE);
 }
 
+/**
+  Check that we are not using table that we are updating in a sub select
+
+  @param thd             Thread handle
+  @param table_list      List of table with first to check
+
+  @retval TRUE  Error
+  @retval FALSE OK
+*/
+bool check_unique_table(THD *thd, TABLE_LIST *table_list)
+{
+  TABLE_LIST *duplicate;
+  DBUG_ENTER("check_unique_table");
+  if ((duplicate= unique_table(thd, table_list, table_list->next_global, 0)))
+  {
+    update_non_unique_table_error(table_list, "UPDATE", duplicate);
+    DBUG_RETURN(TRUE);
+  }
+  DBUG_RETURN(FALSE);
+}
 
 /***************************************************************************
   Update multiple tables from join 
diff --git a/sql/sql_update.h b/sql/sql_update.h
index 64029c5..4c6f89d 100644
--- a/sql/sql_update.h
+++ b/sql/sql_update.h
@@ -27,6 +27,7 @@ typedef class st_select_lex_unit SELECT_LEX_UNIT;
 
 bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
                           Item **conds, uint order_num, ORDER *order);
+bool check_unique_table(THD *thd, TABLE_LIST *table_list);
 int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
 		 List<Item> &values,COND *conds,
 		 uint order_num, ORDER *order, ha_rows limit,
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 255f876..e6c5ffd 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1520,6 +1520,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
       */
       lex->sql_command= old_lex->sql_command;
       lex->duplicates= old_lex->duplicates;
+
+      /* Fields in this view can be used in upper select in case of merge.  */
+      if (table->select_lex)
+        table->select_lex->select_n_where_fields+=
+          lex->select_lex.select_n_where_fields;
     }
     /*
       This method has a dependency on the proper lock type being set,
diff --git a/sql/sql_yacc.cc b/sql/sql_yacc.cc
index 6aee251..c1b6c8e 100644
--- a/sql/sql_yacc.cc
+++ b/sql/sql_yacc.cc
@@ -3645,129 +3645,129 @@ static const yytype_uint16 yyrline[] =
     9621,  9622,  9628,  9629,  9649,  9651,  9655,  9653,  9670,  9668,
     9686,  9684,  9691,  9700,  9698,  9716,  9715,  9725,  9736,  9734,
     9753,  9752,  9763,  9774,  9775,  9776,  9788,  9788,  9802,  9842,
-    9918,  9929,  9934,  9926,  9953,  9973,  9981,  9973,  9990,  9989,
-   10012, 10029, 10012, 10036, 10040, 10066, 10067, 10072, 10075, 10076,
-   10077, 10081, 10082, 10087, 10086, 10092, 10091, 10099, 10100, 10103,
-   10105, 10105, 10109, 10109, 10114, 10115, 10119, 10121, 10126, 10127,
-   10131, 10142, 10155, 10156, 10157, 10158, 10159, 10160, 10161, 10162,
-   10163, 10164, 10165, 10166, 10170, 10171, 10172, 10173, 10174, 10175,
-   10176, 10177, 10178, 10182, 10183, 10184, 10185, 10188, 10190, 10191,
-   10195, 10196, 10204, 10206, 10210, 10212, 10211, 10225, 10228, 10227,
-   10242, 10248, 10262, 10264, 10268, 10270, 10275, 10276, 10296, 10321,
-   10325, 10326, 10330, 10342, 10344, 10349, 10348, 10383, 10385, 10390,
-   10391, 10392, 10397, 10404, 10408, 10409, 10413, 10417, 10421, 10428,
-   10435, 10442, 10452, 10485, 10489, 10495, 10501, 10510, 10518, 10522,
-   10529, 10530, 10534, 10535, 10536, 10540, 10541, 10542, 10543, 10544,
-   10545, 10549, 10550, 10551, 10552, 10553, 10557, 10558, 10559, 10560,
-   10561, 10565, 10566, 10567, 10568, 10569, 10573, 10578, 10579, 10583,
-   10584, 10587, 10590, 10589, 10632, 10633, 10637, 10638, 10642, 10652,
-   10652, 10662, 10663, 10667, 10686, 10719, 10718, 10731, 10739, 10730,
-   10741, 10753, 10765, 10764, 10782, 10781, 10792, 10792, 10808, 10815,
-   10837, 10857, 10869, 10874, 10873, 10883, 10889, 10896, 10901, 10906,
-   10916, 10917, 10921, 10932, 10933, 10937, 10948, 10949, 10953, 10954,
-   10962, 10970, 10961, 10980, 10987, 10979, 10997, 11005, 11006, 11014,
-   11018, 11019, 11030, 11031, 11035, 11044, 11045, 11046, 11048, 11047,
-   11058, 11059, 11063, 11064, 11066, 11065, 11069, 11068, 11074, 11075,
-   11079, 11080, 11084, 11094, 11095, 11099, 11100, 11105, 11104, 11118,
-   11119, 11123, 11128, 11136, 11137, 11145, 11147, 11147, 11155, 11163,
-   11154, 11185, 11186, 11190, 11198, 11199, 11203, 11213, 11214, 11221,
-   11220, 11236, 11235, 11247, 11246, 11258, 11257, 11271, 11272, 11276,
-   11289, 11305, 11306, 11310, 11311, 11315, 11316, 11317, 11322, 11321,
-   11342, 11344, 11347, 11349, 11352, 11353, 11356, 11360, 11364, 11368,
-   11372, 11376, 11380, 11384, 11388, 11396, 11399, 11409, 11408, 11423,
-   11430, 11438, 11446, 11454, 11462, 11470, 11477, 11479, 11481, 11490,
-   11494, 11499, 11498, 11504, 11503, 11508, 11517, 11524, 11533, 11542,
-   11547, 11549, 11551, 11553, 11555, 11557, 11564, 11572, 11574, 11582,
-   11589, 11596, 11606, 11613, 11619, 11627, 11635, 11639, 11643, 11650,
-   11657, 11664, 11671, 11678, 11685, 11691, 11698, 11705, 11710, 11715,
-   11723, 11725, 11727, 11732, 11733, 11736, 11738, 11742, 11743, 11747,
-   11748, 11752, 11753, 11757, 11758, 11762, 11763, 11766, 11768, 11775,
-   11786, 11785, 11801, 11800, 11810, 11811, 11815, 11816, 11817, 11821,
-   11822, 11823, 11838, 11837, 11850, 11859, 11849, 11861, 11865, 11866,
-   11880, 11881, 11886, 11888, 11890, 11892, 11894, 11896, 11898, 11900,
-   11902, 11904, 11906, 11908, 11913, 11915, 11917, 11919, 11921, 11923,
-   11925, 11930, 11931, 11935, 11936, 11940, 11939, 11949, 11950, 11954,
-   11954, 11956, 11957, 11961, 11962, 11967, 11966, 11977, 11981, 11985,
-   11998, 11997, 12011, 12012, 12013, 12016, 12017, 12018, 12022, 12027,
-   12037, 12049, 12060, 12070, 12080, 12048, 12088, 12089, 12093, 12094,
-   12098, 12099, 12107, 12111, 12112, 12113, 12116, 12118, 12122, 12123,
-   12127, 12132, 12139, 12144, 12151, 12153, 12157, 12158, 12162, 12167,
-   12175, 12176, 12179, 12181, 12189, 12191, 12195, 12196, 12197, 12201,
-   12203, 12208, 12209, 12218, 12219, 12223, 12224, 12228, 12241, 12264,
-   12276, 12287, 12306, 12314, 12326, 12334, 12349, 12369, 12370, 12371,
-   12379, 12380, 12381, 12388, 12394, 12400, 12406, 12412, 12418, 12447,
-   12475, 12476, 12477, 12481, 12491, 12501, 12507, 12516, 12531, 12532,
-   12536, 12545, 12560, 12564, 12610, 12614, 12631, 12635, 12713, 12737,
-   12767, 12768, 12784, 12794, 12798, 12804, 12810, 12820, 12826, 12835,
-   12845, 12846, 12874, 12888, 12902, 12917, 12918, 12928, 12929, 12939,
-   12940, 12941, 12945, 12961, 12982, 12997, 12998, 12999, 13000, 13001,
-   13002, 13003, 13004, 13005, 13006, 13007, 13008, 13009, 13010, 13011,
-   13012, 13013, 13014, 13015, 13016, 13017, 13018, 13019, 13020, 13021,
-   13022, 13023, 13024, 13025, 13026, 13027, 13028, 13029, 13030, 13031,
-   13032, 13033, 13034, 13035, 13036, 13037, 13038, 13039, 13040, 13041,
-   13042, 13043, 13044, 13045, 13046, 13047, 13048, 13049, 13050, 13051,
-   13052, 13053, 13054, 13055, 13065, 13066, 13067, 13068, 13069, 13070,
-   13071, 13072, 13073, 13074, 13075, 13076, 13077, 13078, 13079, 13080,
-   13081, 13082, 13083, 13084, 13085, 13086, 13087, 13088, 13089, 13090,
-   13091, 13092, 13093, 13094, 13095, 13096, 13097, 13098, 13099, 13100,
-   13101, 13102, 13103, 13104, 13105, 13106, 13107, 13108, 13109, 13110,
-   13111, 13112, 13113, 13114, 13115, 13116, 13117, 13118, 13119, 13120,
-   13121, 13122, 13123, 13124, 13125, 13126, 13127, 13128, 13129, 13130,
-   13131, 13132, 13133, 13134, 13135, 13136, 13137, 13138, 13139, 13140,
-   13141, 13142, 13143, 13144, 13145, 13146, 13147, 13148, 13149, 13150,
-   13151, 13152, 13153, 13154, 13155, 13156, 13157, 13158, 13159, 13160,
-   13161, 13162, 13163, 13164, 13165, 13166, 13167, 13168, 13169, 13170,
-   13171, 13172, 13173, 13174, 13175, 13176, 13177, 13178, 13179, 13180,
-   13181, 13182, 13183, 13184, 13185, 13186, 13187, 13188, 13189, 13190,
-   13191, 13192, 13193, 13194, 13195, 13196, 13197, 13198, 13199, 13200,
-   13201, 13202, 13203, 13204, 13205, 13206, 13207, 13208, 13209, 13210,
-   13211, 13212, 13213, 13214, 13215, 13216, 13217, 13218, 13219, 13220,
-   13221, 13222, 13223, 13224, 13225, 13226, 13227, 13228, 13229, 13230,
-   13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13240,
-   13241, 13242, 13243, 13244, 13245, 13246, 13247, 13248, 13249, 13250,
-   13251, 13252, 13253, 13254, 13255, 13256, 13257, 13258, 13259, 13260,
-   13261, 13262, 13263, 13264, 13265, 13266, 13267, 13268, 13269, 13270,
-   13271, 13272, 13273, 13274, 13275, 13276, 13277, 13278, 13279, 13280,
-   13281, 13282, 13283, 13284, 13285, 13286, 13287, 13288, 13289, 13290,
-   13291, 13292, 13293, 13294, 13295, 13296, 13297, 13298, 13299, 13300,
-   13301, 13302, 13303, 13304, 13305, 13306, 13307, 13308, 13309, 13310,
-   13311, 13312, 13313, 13314, 13315, 13316, 13317, 13318, 13319, 13320,
-   13321, 13322, 13323, 13324, 13325, 13326, 13327, 13328, 13329, 13330,
-   13331, 13332, 13333, 13334, 13335, 13336, 13337, 13338, 13339, 13340,
-   13341, 13342, 13343, 13344, 13345, 13346, 13347, 13348, 13349, 13350,
-   13351, 13352, 13353, 13354, 13355, 13356, 13357, 13364, 13363, 13378,
-   13379, 13383, 13384, 13388, 13388, 13468, 13469, 13470, 13471, 13475,
-   13476, 13480, 13481, 13482, 13483, 13487, 13488, 13489, 13490, 13494,
-   13495, 13499, 13540, 13558, 13569, 13581, 13594, 13609, 13628, 13654,
-   13667, 13693, 13736, 13750, 13751, 13752, 13753, 13757, 13758, 13767,
-   13779, 13780, 13781, 13787, 13793, 13805, 13804, 13820, 13821, 13825,
-   13826, 13830, 13845, 13846, 13847, 13852, 13853, 13858, 13857, 13877,
-   13889, 13902, 13901, 13935, 13936, 13940, 13941, 13945, 13946, 13947,
-   13948, 13950, 13949, 13962, 13963, 13964, 13965, 13966, 13972, 13977,
-   13983, 13994, 14005, 14009, 14019, 14024, 14031, 14043, 14055, 14064,
-   14066, 14070, 14071, 14078, 14080, 14084, 14085, 14090, 14089, 14093,
-   14092, 14096, 14095, 14099, 14098, 14101, 14102, 14103, 14104, 14105,
-   14106, 14107, 14108, 14109, 14110, 14111, 14112, 14113, 14114, 14115,
-   14116, 14117, 14118, 14119, 14120, 14121, 14122, 14123, 14124, 14125,
-   14126, 14130, 14131, 14135, 14136, 14140, 14150, 14160, 14173, 14188,
-   14201, 14214, 14226, 14231, 14239, 14244, 14251, 14251, 14252, 14252,
-   14255, 14282, 14287, 14293, 14299, 14305, 14309, 14313, 14314, 14318,
-   14345, 14347, 14351, 14355, 14359, 14366, 14367, 14371, 14372, 14376,
-   14377, 14381, 14382, 14388, 14394, 14400, 14410, 14409, 14419, 14420,
-   14425, 14426, 14427, 14432, 14433, 14434, 14438, 14439, 14443, 14455,
-   14464, 14474, 14483, 14497, 14498, 14503, 14502, 14518, 14519, 14520,
-   14524, 14525, 14529, 14529, 14551, 14552, 14556, 14557, 14558, 14562,
-   14566, 14573, 14576, 14574, 14590, 14597, 14618, 14642, 14644, 14648,
-   14649, 14653, 14654, 14662, 14663, 14664, 14665, 14671, 14677, 14687,
-   14689, 14691, 14696, 14697, 14698, 14699, 14700, 14704, 14705, 14706,
-   14707, 14708, 14709, 14719, 14720, 14725, 14738, 14751, 14753, 14755,
-   14760, 14765, 14767, 14769, 14775, 14776, 14778, 14784, 14783, 14800,
-   14801, 14805, 14810, 14818, 14818, 14842, 14843, 14848, 14849, 14851,
-   14853, 14871, 14877, 14882, 14864, 14943, 14960, 14984, 15015, 15019,
-   15028, 15051, 14980, 15114, 15138, 15147, 15154, 15113, 15174, 15178,
-   15182, 15186, 15190, 15194, 15201, 15208, 15215, 15225, 15226, 15230,
-   15231, 15232, 15236, 15237, 15242, 15244, 15243, 15249, 15250, 15254,
-   15261, 15271, 15277, 15288
+    9927,  9938,  9943,  9935,  9962,  9982,  9990,  9982,  9999,  9998,
+   10021, 10038, 10021, 10045, 10049, 10075, 10076, 10081, 10084, 10085,
+   10086, 10090, 10091, 10096, 10095, 10101, 10100, 10108, 10109, 10112,
+   10114, 10114, 10118, 10118, 10123, 10124, 10128, 10130, 10135, 10136,
+   10140, 10151, 10164, 10165, 10166, 10167, 10168, 10169, 10170, 10171,
+   10172, 10173, 10174, 10175, 10179, 10180, 10181, 10182, 10183, 10184,
+   10185, 10186, 10187, 10191, 10192, 10193, 10194, 10197, 10199, 10200,
+   10204, 10205, 10213, 10215, 10219, 10221, 10220, 10234, 10237, 10236,
+   10251, 10257, 10271, 10273, 10277, 10279, 10284, 10285, 10305, 10330,
+   10334, 10335, 10339, 10351, 10353, 10358, 10357, 10392, 10394, 10399,
+   10400, 10401, 10406, 10413, 10417, 10418, 10422, 10426, 10430, 10437,
+   10444, 10451, 10461, 10494, 10498, 10504, 10510, 10519, 10527, 10531,
+   10538, 10539, 10543, 10544, 10545, 10549, 10550, 10551, 10552, 10553,
+   10554, 10558, 10559, 10560, 10561, 10562, 10566, 10567, 10568, 10569,
+   10570, 10574, 10575, 10576, 10577, 10578, 10582, 10587, 10588, 10592,
+   10593, 10596, 10599, 10598, 10641, 10642, 10646, 10647, 10651, 10661,
+   10661, 10671, 10672, 10676, 10695, 10728, 10727, 10740, 10748, 10739,
+   10750, 10762, 10774, 10773, 10791, 10790, 10801, 10801, 10817, 10824,
+   10846, 10866, 10878, 10883, 10882, 10892, 10898, 10905, 10910, 10915,
+   10925, 10926, 10930, 10941, 10942, 10946, 10957, 10958, 10962, 10963,
+   10971, 10979, 10970, 10989, 10996, 10988, 11006, 11014, 11015, 11023,
+   11027, 11028, 11039, 11040, 11044, 11053, 11054, 11055, 11057, 11056,
+   11067, 11068, 11072, 11073, 11075, 11074, 11078, 11077, 11083, 11084,
+   11088, 11089, 11093, 11103, 11104, 11108, 11109, 11114, 11113, 11127,
+   11128, 11132, 11137, 11145, 11146, 11154, 11156, 11156, 11164, 11172,
+   11163, 11194, 11195, 11199, 11207, 11208, 11212, 11222, 11223, 11230,
+   11229, 11245, 11244, 11256, 11255, 11267, 11266, 11280, 11281, 11285,
+   11298, 11314, 11315, 11319, 11320, 11324, 11325, 11326, 11331, 11330,
+   11351, 11353, 11356, 11358, 11361, 11362, 11365, 11369, 11373, 11377,
+   11381, 11385, 11389, 11393, 11397, 11405, 11408, 11418, 11417, 11432,
+   11439, 11447, 11455, 11463, 11471, 11479, 11486, 11488, 11490, 11499,
+   11503, 11508, 11507, 11513, 11512, 11517, 11526, 11533, 11542, 11551,
+   11556, 11558, 11560, 11562, 11564, 11566, 11573, 11581, 11583, 11591,
+   11598, 11605, 11615, 11622, 11628, 11636, 11644, 11648, 11652, 11659,
+   11666, 11673, 11680, 11687, 11694, 11700, 11707, 11714, 11719, 11724,
+   11732, 11734, 11736, 11741, 11742, 11745, 11747, 11751, 11752, 11756,
+   11757, 11761, 11762, 11766, 11767, 11771, 11772, 11775, 11777, 11784,
+   11795, 11794, 11810, 11809, 11819, 11820, 11824, 11825, 11826, 11830,
+   11831, 11832, 11847, 11846, 11859, 11868, 11858, 11870, 11874, 11875,
+   11889, 11890, 11895, 11897, 11899, 11901, 11903, 11905, 11907, 11909,
+   11911, 11913, 11915, 11917, 11922, 11924, 11926, 11928, 11930, 11932,
+   11934, 11939, 11940, 11944, 11945, 11949, 11948, 11958, 11959, 11963,
+   11963, 11965, 11966, 11970, 11971, 11976, 11975, 11986, 11990, 11994,
+   12007, 12006, 12020, 12021, 12022, 12025, 12026, 12027, 12031, 12036,
+   12046, 12058, 12069, 12079, 12089, 12057, 12097, 12098, 12102, 12103,
+   12107, 12108, 12116, 12120, 12121, 12122, 12125, 12127, 12131, 12132,
+   12136, 12141, 12148, 12153, 12160, 12162, 12166, 12167, 12171, 12176,
+   12184, 12185, 12188, 12190, 12198, 12200, 12204, 12205, 12206, 12210,
+   12212, 12217, 12218, 12227, 12228, 12232, 12233, 12237, 12250, 12273,
+   12285, 12296, 12315, 12323, 12335, 12343, 12358, 12378, 12379, 12380,
+   12388, 12389, 12390, 12397, 12403, 12409, 12415, 12421, 12427, 12456,
+   12484, 12485, 12486, 12490, 12500, 12510, 12516, 12525, 12540, 12541,
+   12545, 12554, 12569, 12573, 12619, 12623, 12640, 12644, 12722, 12746,
+   12776, 12777, 12793, 12803, 12807, 12813, 12819, 12829, 12835, 12844,
+   12854, 12855, 12883, 12897, 12911, 12926, 12927, 12937, 12938, 12948,
+   12949, 12950, 12954, 12970, 12991, 13006, 13007, 13008, 13009, 13010,
+   13011, 13012, 13013, 13014, 13015, 13016, 13017, 13018, 13019, 13020,
+   13021, 13022, 13023, 13024, 13025, 13026, 13027, 13028, 13029, 13030,
+   13031, 13032, 13033, 13034, 13035, 13036, 13037, 13038, 13039, 13040,
+   13041, 13042, 13043, 13044, 13045, 13046, 13047, 13048, 13049, 13050,
+   13051, 13052, 13053, 13054, 13055, 13056, 13057, 13058, 13059, 13060,
+   13061, 13062, 13063, 13064, 13074, 13075, 13076, 13077, 13078, 13079,
+   13080, 13081, 13082, 13083, 13084, 13085, 13086, 13087, 13088, 13089,
+   13090, 13091, 13092, 13093, 13094, 13095, 13096, 13097, 13098, 13099,
+   13100, 13101, 13102, 13103, 13104, 13105, 13106, 13107, 13108, 13109,
+   13110, 13111, 13112, 13113, 13114, 13115, 13116, 13117, 13118, 13119,
+   13120, 13121, 13122, 13123, 13124, 13125, 13126, 13127, 13128, 13129,
+   13130, 13131, 13132, 13133, 13134, 13135, 13136, 13137, 13138, 13139,
+   13140, 13141, 13142, 13143, 13144, 13145, 13146, 13147, 13148, 13149,
+   13150, 13151, 13152, 13153, 13154, 13155, 13156, 13157, 13158, 13159,
+   13160, 13161, 13162, 13163, 13164, 13165, 13166, 13167, 13168, 13169,
+   13170, 13171, 13172, 13173, 13174, 13175, 13176, 13177, 13178, 13179,
+   13180, 13181, 13182, 13183, 13184, 13185, 13186, 13187, 13188, 13189,
+   13190, 13191, 13192, 13193, 13194, 13195, 13196, 13197, 13198, 13199,
+   13200, 13201, 13202, 13203, 13204, 13205, 13206, 13207, 13208, 13209,
+   13210, 13211, 13212, 13213, 13214, 13215, 13216, 13217, 13218, 13219,
+   13220, 13221, 13222, 13223, 13224, 13225, 13226, 13227, 13228, 13229,
+   13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239,
+   13240, 13241, 13242, 13243, 13244, 13245, 13246, 13247, 13248, 13249,
+   13250, 13251, 13252, 13253, 13254, 13255, 13256, 13257, 13258, 13259,
+   13260, 13261, 13262, 13263, 13264, 13265, 13266, 13267, 13268, 13269,
+   13270, 13271, 13272, 13273, 13274, 13275, 13276, 13277, 13278, 13279,
+   13280, 13281, 13282, 13283, 13284, 13285, 13286, 13287, 13288, 13289,
+   13290, 13291, 13292, 13293, 13294, 13295, 13296, 13297, 13298, 13299,
+   13300, 13301, 13302, 13303, 13304, 13305, 13306, 13307, 13308, 13309,
+   13310, 13311, 13312, 13313, 13314, 13315, 13316, 13317, 13318, 13319,
+   13320, 13321, 13322, 13323, 13324, 13325, 13326, 13327, 13328, 13329,
+   13330, 13331, 13332, 13333, 13334, 13335, 13336, 13337, 13338, 13339,
+   13340, 13341, 13342, 13343, 13344, 13345, 13346, 13347, 13348, 13349,
+   13350, 13351, 13352, 13353, 13354, 13355, 13356, 13357, 13358, 13359,
+   13360, 13361, 13362, 13363, 13364, 13365, 13366, 13373, 13372, 13387,
+   13388, 13392, 13393, 13397, 13397, 13477, 13478, 13479, 13480, 13484,
+   13485, 13489, 13490, 13491, 13492, 13496, 13497, 13498, 13499, 13503,
+   13504, 13508, 13549, 13567, 13578, 13590, 13603, 13618, 13637, 13663,
+   13676, 13702, 13745, 13759, 13760, 13761, 13762, 13766, 13767, 13776,
+   13788, 13789, 13790, 13796, 13802, 13814, 13813, 13829, 13830, 13834,
+   13835, 13839, 13854, 13855, 13856, 13861, 13862, 13867, 13866, 13886,
+   13898, 13911, 13910, 13944, 13945, 13949, 13950, 13954, 13955, 13956,
+   13957, 13959, 13958, 13971, 13972, 13973, 13974, 13975, 13981, 13986,
+   13992, 14003, 14014, 14018, 14028, 14033, 14040, 14052, 14064, 14073,
+   14075, 14079, 14080, 14087, 14089, 14093, 14094, 14099, 14098, 14102,
+   14101, 14105, 14104, 14108, 14107, 14110, 14111, 14112, 14113, 14114,
+   14115, 14116, 14117, 14118, 14119, 14120, 14121, 14122, 14123, 14124,
+   14125, 14126, 14127, 14128, 14129, 14130, 14131, 14132, 14133, 14134,
+   14135, 14139, 14140, 14144, 14145, 14149, 14159, 14169, 14182, 14197,
+   14210, 14223, 14235, 14240, 14248, 14253, 14260, 14260, 14261, 14261,
+   14264, 14291, 14296, 14302, 14308, 14314, 14318, 14322, 14323, 14327,
+   14354, 14356, 14360, 14364, 14368, 14375, 14376, 14380, 14381, 14385,
+   14386, 14390, 14391, 14397, 14403, 14409, 14419, 14418, 14428, 14429,
+   14434, 14435, 14436, 14441, 14442, 14443, 14447, 14448, 14452, 14464,
+   14473, 14483, 14492, 14506, 14507, 14512, 14511, 14527, 14528, 14529,
+   14533, 14534, 14538, 14538, 14560, 14561, 14565, 14566, 14567, 14571,
+   14575, 14582, 14585, 14583, 14599, 14606, 14627, 14651, 14653, 14657,
+   14658, 14662, 14663, 14671, 14672, 14673, 14674, 14680, 14686, 14696,
+   14698, 14700, 14705, 14706, 14707, 14708, 14709, 14713, 14714, 14715,
+   14716, 14717, 14718, 14728, 14729, 14734, 14747, 14760, 14762, 14764,
+   14769, 14774, 14776, 14778, 14784, 14785, 14787, 14793, 14792, 14809,
+   14810, 14814, 14819, 14827, 14827, 14851, 14852, 14857, 14858, 14860,
+   14862, 14880, 14886, 14891, 14873, 14952, 14969, 14993, 15024, 15028,
+   15037, 15060, 14989, 15123, 15147, 15156, 15163, 15122, 15183, 15187,
+   15191, 15195, 15199, 15203, 15210, 15217, 15224, 15234, 15235, 15239,
+   15240, 15241, 15245, 15246, 15251, 15253, 15252, 15258, 15259, 15263,
+   15270, 15280, 15286, 15297
 };
 #endif
 
@@ -30562,6 +30562,15 @@ yyreduce:
               sel->add_joined_table((yyval.table_list));
               lex->pop_context();
               lex->nest_level--;
+              /*
+                Fields in derived table can be used in upper select in
+                case of merge. We do not add HAVING fields because we do
+                not merge such derived. We do not add union because
+                also do not merge them
+              */
+              if (!sel->next_select())
+                (yyvsp[(2) - (5)].select_lex)->select_n_where_fields+=
+                  sel->select_n_where_fields;
             }
             /*else if (($3->select_lex &&
                       $3->select_lex->master_unit()->is_union() &&
@@ -30588,7 +30597,7 @@ yyreduce:
   case 1420:
 
 /* Line 1455 of yacc.c  */
-#line 9919 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9928 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if ((yyvsp[(1) - (2)].table_list) && (yyvsp[(2) - (2)].is_not_empty))
             {
@@ -30601,7 +30610,7 @@ yyreduce:
   case 1421:
 
 /* Line 1455 of yacc.c  */
-#line 9929 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9938 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (add_select_to_union_list(Lex, (bool)(yyvsp[(3) - (3)].num), FALSE))
               MYSQL_YYABORT;
@@ -30611,7 +30620,7 @@ yyreduce:
   case 1422:
 
 /* Line 1455 of yacc.c  */
-#line 9934 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9943 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               Remove from the name resolution context stack the context of the
@@ -30624,7 +30633,7 @@ yyreduce:
   case 1423:
 
 /* Line 1455 of yacc.c  */
-#line 9942 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9951 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if ((yyvsp[(1) - (7)].table_list) != NULL)
             {
@@ -30637,7 +30646,7 @@ yyreduce:
   case 1424:
 
 /* Line 1455 of yacc.c  */
-#line 9954 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9963 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             SELECT_LEX * sel= lex->current_select;
@@ -30658,7 +30667,7 @@ yyreduce:
   case 1425:
 
 /* Line 1455 of yacc.c  */
-#line 9973 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9982 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             SELECT_LEX *sel= lex->current_select;
@@ -30671,7 +30680,7 @@ yyreduce:
   case 1426:
 
 /* Line 1455 of yacc.c  */
-#line 9981 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9990 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= NO_MATTER;
           }
@@ -30680,7 +30689,7 @@ yyreduce:
   case 1428:
 
 /* Line 1455 of yacc.c  */
-#line 9990 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 9999 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if ((yyvsp[(1) - (1)].select_lex)->init_nested_join(lex->thd))
@@ -30691,7 +30700,7 @@ yyreduce:
   case 1429:
 
 /* Line 1455 of yacc.c  */
-#line 9996 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10005 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             /* for normal joins, $3 != NULL and end_nested_join() != NULL,
@@ -30710,7 +30719,7 @@ yyreduce:
   case 1430:
 
 /* Line 1455 of yacc.c  */
-#line 10012 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10021 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->derived_tables|= DERIVED_SUBQUERY;
@@ -30732,7 +30741,7 @@ yyreduce:
   case 1431:
 
 /* Line 1455 of yacc.c  */
-#line 10029 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10038 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= NO_MATTER;
           }
@@ -30741,14 +30750,14 @@ yyreduce:
   case 1433:
 
 /* Line 1455 of yacc.c  */
-#line 10036 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10045 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.select_lex)= Select; }
     break;
 
   case 1434:
 
 /* Line 1455 of yacc.c  */
-#line 10041 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10050 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
 
@@ -30776,21 +30785,21 @@ yyreduce:
   case 1435:
 
 /* Line 1455 of yacc.c  */
-#line 10066 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10075 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1436:
 
 /* Line 1455 of yacc.c  */
-#line 10067 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10076 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1437:
 
 /* Line 1455 of yacc.c  */
-#line 10072 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10081 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.num)= thd->variables.old_mode ?  INDEX_HINT_MASK_JOIN : INDEX_HINT_MASK_ALL; 
           }
@@ -30799,42 +30808,42 @@ yyreduce:
   case 1438:
 
 /* Line 1455 of yacc.c  */
-#line 10075 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10084 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= INDEX_HINT_MASK_JOIN;  }
     break;
 
   case 1439:
 
 /* Line 1455 of yacc.c  */
-#line 10076 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10085 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= INDEX_HINT_MASK_ORDER; }
     break;
 
   case 1440:
 
 /* Line 1455 of yacc.c  */
-#line 10077 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10086 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= INDEX_HINT_MASK_GROUP; }
     break;
 
   case 1441:
 
 /* Line 1455 of yacc.c  */
-#line 10081 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10090 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.index_hint)= INDEX_HINT_FORCE; }
     break;
 
   case 1442:
 
 /* Line 1455 of yacc.c  */
-#line 10082 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10091 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.index_hint)= INDEX_HINT_IGNORE; }
     break;
 
   case 1443:
 
 /* Line 1455 of yacc.c  */
-#line 10087 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10096 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->set_index_hint_type((yyvsp[(1) - (3)].index_hint), (yyvsp[(3) - (3)].num));
           }
@@ -30843,7 +30852,7 @@ yyreduce:
   case 1445:
 
 /* Line 1455 of yacc.c  */
-#line 10092 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10101 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->set_index_hint_type(INDEX_HINT_USE, (yyvsp[(3) - (3)].num));
           }
@@ -30852,49 +30861,49 @@ yyreduce:
   case 1450:
 
 /* Line 1455 of yacc.c  */
-#line 10105 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10114 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->alloc_index_hints(thd); }
     break;
 
   case 1452:
 
 /* Line 1455 of yacc.c  */
-#line 10109 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10118 "/home/buildbot/git/sql/sql_yacc.yy"
     {  Select->clear_index_hints(); }
     break;
 
   case 1454:
 
 /* Line 1455 of yacc.c  */
-#line 10114 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10123 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->add_index_hint(thd, NULL, 0); }
     break;
 
   case 1455:
 
 /* Line 1455 of yacc.c  */
-#line 10115 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10124 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1456:
 
 /* Line 1455 of yacc.c  */
-#line 10120 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10129 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->add_index_hint(thd, (yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length); }
     break;
 
   case 1457:
 
 /* Line 1455 of yacc.c  */
-#line 10122 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10131 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->add_index_hint(thd, (char *)"PRIMARY", 7); }
     break;
 
   case 1460:
 
 /* Line 1455 of yacc.c  */
-#line 10132 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10141 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!((yyval.string_list)= new List<String>))
               MYSQL_YYABORT;
@@ -30910,7 +30919,7 @@ yyreduce:
   case 1461:
 
 /* Line 1455 of yacc.c  */
-#line 10143 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10152 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             String *s= new (thd->mem_root) String((const char *) (yyvsp[(3) - (3)].lex_str).str,
                                                     (yyvsp[(3) - (3)].lex_str).length,
@@ -30925,189 +30934,189 @@ yyreduce:
   case 1462:
 
 /* Line 1455 of yacc.c  */
-#line 10155 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10164 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1463:
 
 /* Line 1455 of yacc.c  */
-#line 10156 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10165 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_DAY_HOUR; }
     break;
 
   case 1464:
 
 /* Line 1455 of yacc.c  */
-#line 10157 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10166 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_DAY_MICROSECOND; }
     break;
 
   case 1465:
 
 /* Line 1455 of yacc.c  */
-#line 10158 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10167 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_DAY_MINUTE; }
     break;
 
   case 1466:
 
 /* Line 1455 of yacc.c  */
-#line 10159 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10168 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_DAY_SECOND; }
     break;
 
   case 1467:
 
 /* Line 1455 of yacc.c  */
-#line 10160 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10169 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_HOUR_MICROSECOND; }
     break;
 
   case 1468:
 
 /* Line 1455 of yacc.c  */
-#line 10161 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10170 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_HOUR_MINUTE; }
     break;
 
   case 1469:
 
 /* Line 1455 of yacc.c  */
-#line 10162 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10171 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_HOUR_SECOND; }
     break;
 
   case 1470:
 
 /* Line 1455 of yacc.c  */
-#line 10163 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10172 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_MINUTE_MICROSECOND; }
     break;
 
   case 1471:
 
 /* Line 1455 of yacc.c  */
-#line 10164 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10173 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_MINUTE_SECOND; }
     break;
 
   case 1472:
 
 /* Line 1455 of yacc.c  */
-#line 10165 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10174 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_SECOND_MICROSECOND; }
     break;
 
   case 1473:
 
 /* Line 1455 of yacc.c  */
-#line 10166 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10175 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval)=INTERVAL_YEAR_MONTH; }
     break;
 
   case 1474:
 
 /* Line 1455 of yacc.c  */
-#line 10170 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10179 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_DAY; }
     break;
 
   case 1475:
 
 /* Line 1455 of yacc.c  */
-#line 10171 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10180 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_WEEK; }
     break;
 
   case 1476:
 
 /* Line 1455 of yacc.c  */
-#line 10172 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10181 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_HOUR; }
     break;
 
   case 1477:
 
 /* Line 1455 of yacc.c  */
-#line 10173 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10182 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_MINUTE; }
     break;
 
   case 1478:
 
 /* Line 1455 of yacc.c  */
-#line 10174 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10183 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_MONTH; }
     break;
 
   case 1479:
 
 /* Line 1455 of yacc.c  */
-#line 10175 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10184 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_QUARTER; }
     break;
 
   case 1480:
 
 /* Line 1455 of yacc.c  */
-#line 10176 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10185 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_SECOND; }
     break;
 
   case 1481:
 
 /* Line 1455 of yacc.c  */
-#line 10177 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10186 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_MICROSECOND; }
     break;
 
   case 1482:
 
 /* Line 1455 of yacc.c  */
-#line 10178 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10187 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.interval_time_st)=INTERVAL_YEAR; }
     break;
 
   case 1483:
 
 /* Line 1455 of yacc.c  */
-#line 10182 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10191 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.date_time_type)=MYSQL_TIMESTAMP_DATE;}
     break;
 
   case 1484:
 
 /* Line 1455 of yacc.c  */
-#line 10183 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10192 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.date_time_type)=MYSQL_TIMESTAMP_TIME;}
     break;
 
   case 1485:
 
 /* Line 1455 of yacc.c  */
-#line 10184 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10193 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.date_time_type)=MYSQL_TIMESTAMP_DATETIME;}
     break;
 
   case 1486:
 
 /* Line 1455 of yacc.c  */
-#line 10185 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10194 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.date_time_type)=MYSQL_TIMESTAMP_DATETIME;}
     break;
 
   case 1490:
 
 /* Line 1455 of yacc.c  */
-#line 10195 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10204 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str_ptr)=0; }
     break;
 
   case 1491:
 
 /* Line 1455 of yacc.c  */
-#line 10197 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10206 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_str_ptr)= (LEX_STRING*) sql_memdup(&(yyvsp[(2) - (2)].lex_str),sizeof(LEX_STRING));
             if ((yyval.lex_str_ptr) == NULL)
@@ -31118,14 +31127,14 @@ yyreduce:
   case 1494:
 
 /* Line 1455 of yacc.c  */
-#line 10210 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10219 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->where= 0; }
     break;
 
   case 1495:
 
 /* Line 1455 of yacc.c  */
-#line 10212 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10221 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= IN_WHERE;
           }
@@ -31134,7 +31143,7 @@ yyreduce:
   case 1496:
 
 /* Line 1455 of yacc.c  */
-#line 10216 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10225 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *select= Select;
             select->where= normalize_cond((yyvsp[(3) - (3)].item));
@@ -31147,7 +31156,7 @@ yyreduce:
   case 1498:
 
 /* Line 1455 of yacc.c  */
-#line 10228 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10237 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= IN_HAVING;
           }
@@ -31156,7 +31165,7 @@ yyreduce:
   case 1499:
 
 /* Line 1455 of yacc.c  */
-#line 10232 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10241 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             sel->having= normalize_cond((yyvsp[(3) - (3)].item));
@@ -31169,7 +31178,7 @@ yyreduce:
   case 1500:
 
 /* Line 1455 of yacc.c  */
-#line 10243 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10252 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->escape_used= TRUE;
             (yyval.item)= (yyvsp[(2) - (2)].item);
@@ -31179,7 +31188,7 @@ yyreduce:
   case 1501:
 
 /* Line 1455 of yacc.c  */
-#line 10248 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10257 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->escape_used= FALSE;
             (yyval.item)= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
@@ -31193,28 +31202,28 @@ yyreduce:
   case 1504:
 
 /* Line 1455 of yacc.c  */
-#line 10269 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10278 "/home/buildbot/git/sql/sql_yacc.yy"
     { if (add_group_to_list(thd, (yyvsp[(3) - (4)].item),(bool) (yyvsp[(4) - (4)].num))) MYSQL_YYABORT; }
     break;
 
   case 1505:
 
 /* Line 1455 of yacc.c  */
-#line 10271 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10280 "/home/buildbot/git/sql/sql_yacc.yy"
     { if (add_group_to_list(thd, (yyvsp[(1) - (2)].item),(bool) (yyvsp[(2) - (2)].num))) MYSQL_YYABORT; }
     break;
 
   case 1506:
 
 /* Line 1455 of yacc.c  */
-#line 10275 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10284 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1507:
 
 /* Line 1455 of yacc.c  */
-#line 10277 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10286 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               'WITH CUBE' is reserved in the MySQL syntax, but not implemented,
@@ -31239,7 +31248,7 @@ yyreduce:
   case 1508:
 
 /* Line 1455 of yacc.c  */
-#line 10297 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10306 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               'WITH ROLLUP' is needed for backward compatibility,
@@ -31262,7 +31271,7 @@ yyreduce:
   case 1512:
 
 /* Line 1455 of yacc.c  */
-#line 10331 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10340 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             bool ascending= ((yyvsp[(2) - (2)].num) == 1) ? true : false;
             if (add_order_to_list(thd, (yyvsp[(1) - (2)].item), ascending))
@@ -31273,7 +31282,7 @@ yyreduce:
   case 1515:
 
 /* Line 1455 of yacc.c  */
-#line 10349 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10358 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             SELECT_LEX *sel= lex->current_select;
@@ -31309,42 +31318,42 @@ yyreduce:
   case 1517:
 
 /* Line 1455 of yacc.c  */
-#line 10384 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10393 "/home/buildbot/git/sql/sql_yacc.yy"
     { if (add_order_to_list(thd, (yyvsp[(3) - (4)].item),(bool) (yyvsp[(4) - (4)].num))) MYSQL_YYABORT; }
     break;
 
   case 1518:
 
 /* Line 1455 of yacc.c  */
-#line 10386 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10395 "/home/buildbot/git/sql/sql_yacc.yy"
     { if (add_order_to_list(thd, (yyvsp[(1) - (2)].item),(bool) (yyvsp[(2) - (2)].num))) MYSQL_YYABORT; }
     break;
 
   case 1519:
 
 /* Line 1455 of yacc.c  */
-#line 10390 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10399 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num) =  1; }
     break;
 
   case 1520:
 
 /* Line 1455 of yacc.c  */
-#line 10391 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10400 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num) =1; }
     break;
 
   case 1521:
 
 /* Line 1455 of yacc.c  */
-#line 10392 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10401 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num) =0; }
     break;
 
   case 1522:
 
 /* Line 1455 of yacc.c  */
-#line 10397 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10406 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             SELECT_LEX *sel= lex->current_select;
@@ -31357,28 +31366,28 @@ yyreduce:
   case 1523:
 
 /* Line 1455 of yacc.c  */
-#line 10404 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10413 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1524:
 
 /* Line 1455 of yacc.c  */
-#line 10408 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10417 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1525:
 
 /* Line 1455 of yacc.c  */
-#line 10409 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10418 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1526:
 
 /* Line 1455 of yacc.c  */
-#line 10414 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10423 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
           }
@@ -31387,7 +31396,7 @@ yyreduce:
   case 1527:
 
 /* Line 1455 of yacc.c  */
-#line 10418 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10427 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
           }
@@ -31396,7 +31405,7 @@ yyreduce:
   case 1528:
 
 /* Line 1455 of yacc.c  */
-#line 10422 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10431 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
           }
@@ -31405,7 +31414,7 @@ yyreduce:
   case 1529:
 
 /* Line 1455 of yacc.c  */
-#line 10429 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10438 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             sel->select_limit= (yyvsp[(1) - (1)].item);
@@ -31417,7 +31426,7 @@ yyreduce:
   case 1530:
 
 /* Line 1455 of yacc.c  */
-#line 10436 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10445 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             sel->select_limit= (yyvsp[(3) - (3)].item);
@@ -31429,7 +31438,7 @@ yyreduce:
   case 1531:
 
 /* Line 1455 of yacc.c  */
-#line 10443 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10452 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             sel->select_limit= (yyvsp[(1) - (3)].item);
@@ -31441,7 +31450,7 @@ yyreduce:
   case 1532:
 
 /* Line 1455 of yacc.c  */
-#line 10453 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10462 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           Item_splocal *splocal;
           LEX *lex= thd->lex;
@@ -31479,7 +31488,7 @@ yyreduce:
   case 1533:
 
 /* Line 1455 of yacc.c  */
-#line 10486 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10495 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           ((Item_param *) (yyvsp[(1) - (1)].item))->limit_clause_param= TRUE;
         }
@@ -31488,7 +31497,7 @@ yyreduce:
   case 1534:
 
 /* Line 1455 of yacc.c  */
-#line 10490 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10499 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_uint((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -31499,7 +31508,7 @@ yyreduce:
   case 1535:
 
 /* Line 1455 of yacc.c  */
-#line 10496 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10505 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_uint((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -31510,7 +31519,7 @@ yyreduce:
   case 1536:
 
 /* Line 1455 of yacc.c  */
-#line 10502 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10511 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_uint((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -31521,7 +31530,7 @@ yyreduce:
   case 1537:
 
 /* Line 1455 of yacc.c  */
-#line 10511 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10520 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             LEX *lex=Lex;
             lex->limit_rows_examined= (yyvsp[(1) - (1)].item);
@@ -31531,7 +31540,7 @@ yyreduce:
   case 1538:
 
 /* Line 1455 of yacc.c  */
-#line 10518 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10527 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->current_select->select_limit= 0;
@@ -31541,7 +31550,7 @@ yyreduce:
   case 1539:
 
 /* Line 1455 of yacc.c  */
-#line 10523 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10532 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             sel->select_limit= (yyvsp[(2) - (2)].item);
@@ -31553,210 +31562,210 @@ yyreduce:
   case 1540:
 
 /* Line 1455 of yacc.c  */
-#line 10529 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10538 "/home/buildbot/git/sql/sql_yacc.yy"
     { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
     break;
 
   case 1541:
 
 /* Line 1455 of yacc.c  */
-#line 10530 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10539 "/home/buildbot/git/sql/sql_yacc.yy"
     { my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; }
     break;
 
   case 1542:
 
 /* Line 1455 of yacc.c  */
-#line 10534 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10543 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.num)= (int) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1543:
 
 /* Line 1455 of yacc.c  */
-#line 10535 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10544 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.num)= -(int) my_strtoll10((yyvsp[(2) - (2)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1544:
 
 /* Line 1455 of yacc.c  */
-#line 10536 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10545 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.num)= -(int) my_strtoll10((yyvsp[(2) - (2)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1545:
 
 /* Line 1455 of yacc.c  */
-#line 10540 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10549 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1546:
 
 /* Line 1455 of yacc.c  */
-#line 10541 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10550 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ulong_num)= (ulong) strtol((yyvsp[(1) - (1)].lex_str).str, (char**) 0, 16); }
     break;
 
   case 1547:
 
 /* Line 1455 of yacc.c  */
-#line 10542 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10551 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1548:
 
 /* Line 1455 of yacc.c  */
-#line 10543 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10552 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1549:
 
 /* Line 1455 of yacc.c  */
-#line 10544 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10553 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1550:
 
 /* Line 1455 of yacc.c  */
-#line 10545 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10554 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1551:
 
 /* Line 1455 of yacc.c  */
-#line 10549 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10558 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1552:
 
 /* Line 1455 of yacc.c  */
-#line 10550 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10559 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ulong_num)= (ulong) strtol((yyvsp[(1) - (1)].lex_str).str, (char**) 0, 16); }
     break;
 
   case 1553:
 
 /* Line 1455 of yacc.c  */
-#line 10551 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10560 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1554:
 
 /* Line 1455 of yacc.c  */
-#line 10552 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10561 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulong_num)= (ulong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1555:
 
 /* Line 1455 of yacc.c  */
-#line 10553 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10562 "/home/buildbot/git/sql/sql_yacc.yy"
     { MYSQL_YYABORT; }
     break;
 
   case 1556:
 
 /* Line 1455 of yacc.c  */
-#line 10557 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10566 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1557:
 
 /* Line 1455 of yacc.c  */
-#line 10558 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10567 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1558:
 
 /* Line 1455 of yacc.c  */
-#line 10559 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10568 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1559:
 
 /* Line 1455 of yacc.c  */
-#line 10560 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10569 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1560:
 
 /* Line 1455 of yacc.c  */
-#line 10561 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10570 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1561:
 
 /* Line 1455 of yacc.c  */
-#line 10565 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10574 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1562:
 
 /* Line 1455 of yacc.c  */
-#line 10566 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10575 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1563:
 
 /* Line 1455 of yacc.c  */
-#line 10567 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10576 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ulonglong_number)= strtoull((yyvsp[(1) - (1)].lex_str).str, (char**) 0, 16); }
     break;
 
   case 1564:
 
 /* Line 1455 of yacc.c  */
-#line 10568 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10577 "/home/buildbot/git/sql/sql_yacc.yy"
     { int error; (yyval.ulonglong_number)= (ulonglong) my_strtoll10((yyvsp[(1) - (1)].lex_str).str, (char**) 0, &error); }
     break;
 
   case 1565:
 
 /* Line 1455 of yacc.c  */
-#line 10569 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10578 "/home/buildbot/git/sql/sql_yacc.yy"
     { MYSQL_YYABORT; }
     break;
 
   case 1566:
 
 /* Line 1455 of yacc.c  */
-#line 10574 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10583 "/home/buildbot/git/sql/sql_yacc.yy"
     { my_parse_error(ER(ER_ONLY_INTEGERS_ALLOWED)); }
     break;
 
   case 1569:
 
 /* Line 1455 of yacc.c  */
-#line 10583 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10592 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.choice)= (yyvsp[(1) - (1)].ulong_num) != 0 ? HA_CHOICE_YES : HA_CHOICE_NO; }
     break;
 
   case 1570:
 
 /* Line 1455 of yacc.c  */
-#line 10584 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10593 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.choice)= HA_CHOICE_UNDEF; }
     break;
 
   case 1572:
 
 /* Line 1455 of yacc.c  */
-#line 10590 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10599 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
 
@@ -31796,7 +31805,7 @@ yyreduce:
   case 1573:
 
 /* Line 1455 of yacc.c  */
-#line 10625 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10634 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /* Subqueries are allowed from now.*/
             Lex->expr_allows_subselect= true;
@@ -31806,21 +31815,21 @@ yyreduce:
   case 1574:
 
 /* Line 1455 of yacc.c  */
-#line 10632 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10641 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1575:
 
 /* Line 1455 of yacc.c  */
-#line 10633 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10642 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1578:
 
 /* Line 1455 of yacc.c  */
-#line 10643 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10652 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (add_proc_to_list(thd, (yyvsp[(2) - (3)].item)))
               MYSQL_YYABORT;
@@ -31832,7 +31841,7 @@ yyreduce:
   case 1579:
 
 /* Line 1455 of yacc.c  */
-#line 10652 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10661 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!lex->describe && (!(lex->result= new select_dumpvar())))
@@ -31843,21 +31852,21 @@ yyreduce:
   case 1580:
 
 /* Line 1455 of yacc.c  */
-#line 10658 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10667 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1582:
 
 /* Line 1455 of yacc.c  */
-#line 10663 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10672 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1583:
 
 /* Line 1455 of yacc.c  */
-#line 10668 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10677 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->result) 
@@ -31881,7 +31890,7 @@ yyreduce:
   case 1584:
 
 /* Line 1455 of yacc.c  */
-#line 10687 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10696 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             sp_variable_t *t;
@@ -31915,7 +31924,7 @@ yyreduce:
   case 1585:
 
 /* Line 1455 of yacc.c  */
-#line 10719 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10728 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (! Lex->parsing_options.allows_select_into)
             {
@@ -31928,7 +31937,7 @@ yyreduce:
   case 1587:
 
 /* Line 1455 of yacc.c  */
-#line 10731 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10740 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
@@ -31941,14 +31950,14 @@ yyreduce:
   case 1588:
 
 /* Line 1455 of yacc.c  */
-#line 10739 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10748 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->exchange->cs= (yyvsp[(4) - (4)].charset); }
     break;
 
   case 1590:
 
 /* Line 1455 of yacc.c  */
-#line 10742 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10751 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!lex->describe)
@@ -31965,7 +31974,7 @@ yyreduce:
   case 1591:
 
 /* Line 1455 of yacc.c  */
-#line 10754 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10763 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
           }
@@ -31974,7 +31983,7 @@ yyreduce:
   case 1592:
 
 /* Line 1455 of yacc.c  */
-#line 10765 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10774 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command = SQLCOM_DO;
@@ -31985,7 +31994,7 @@ yyreduce:
   case 1593:
 
 /* Line 1455 of yacc.c  */
-#line 10771 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10780 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->insert_list= (yyvsp[(3) - (3)].item_list);
           }
@@ -31994,7 +32003,7 @@ yyreduce:
   case 1594:
 
 /* Line 1455 of yacc.c  */
-#line 10782 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10791 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command = SQLCOM_DROP_TABLE;
@@ -32008,21 +32017,21 @@ yyreduce:
   case 1595:
 
 /* Line 1455 of yacc.c  */
-#line 10791 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10800 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1596:
 
 /* Line 1455 of yacc.c  */
-#line 10792 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10801 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1597:
 
 /* Line 1455 of yacc.c  */
-#line 10793 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10802 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             Alter_drop *ad= new Alter_drop(Alter_drop::KEY, (yyvsp[(3) - (6)].lex_str).str);
@@ -32043,7 +32052,7 @@ yyreduce:
   case 1598:
 
 /* Line 1455 of yacc.c  */
-#line 10809 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10818 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_DROP_DB;
@@ -32055,7 +32064,7 @@ yyreduce:
   case 1599:
 
 /* Line 1455 of yacc.c  */
-#line 10816 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10825 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             sp_name *spname;
@@ -32082,7 +32091,7 @@ yyreduce:
   case 1600:
 
 /* Line 1455 of yacc.c  */
-#line 10838 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10847 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             LEX_STRING db= {0, 0};
@@ -32107,7 +32116,7 @@ yyreduce:
   case 1601:
 
 /* Line 1455 of yacc.c  */
-#line 10858 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10867 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->sphead)
@@ -32124,7 +32133,7 @@ yyreduce:
   case 1602:
 
 /* Line 1455 of yacc.c  */
-#line 10870 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10879 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_DROP_USER;
           }
@@ -32133,7 +32142,7 @@ yyreduce:
   case 1603:
 
 /* Line 1455 of yacc.c  */
-#line 10874 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10883 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_DROP_VIEW;
@@ -32146,14 +32155,14 @@ yyreduce:
   case 1604:
 
 /* Line 1455 of yacc.c  */
-#line 10882 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10891 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1605:
 
 /* Line 1455 of yacc.c  */
-#line 10884 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10893 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->drop_if_exists= (yyvsp[(3) - (4)].num);
             Lex->spname= (yyvsp[(4) - (4)].spname);
@@ -32164,7 +32173,7 @@ yyreduce:
   case 1606:
 
 /* Line 1455 of yacc.c  */
-#line 10890 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10899 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_DROP_TRIGGER;
@@ -32176,7 +32185,7 @@ yyreduce:
   case 1607:
 
 /* Line 1455 of yacc.c  */
-#line 10897 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10906 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->alter_tablespace_info->ts_cmd_type= DROP_TABLESPACE;
@@ -32186,7 +32195,7 @@ yyreduce:
   case 1608:
 
 /* Line 1455 of yacc.c  */
-#line 10902 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10911 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP;
@@ -32196,7 +32205,7 @@ yyreduce:
   case 1609:
 
 /* Line 1455 of yacc.c  */
-#line 10907 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10916 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_DROP_SERVER;
             Lex->drop_if_exists= (yyvsp[(3) - (4)].num);
@@ -32208,7 +32217,7 @@ yyreduce:
   case 1612:
 
 /* Line 1455 of yacc.c  */
-#line 10922 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10931 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!Select->add_table_to_list(thd, (yyvsp[(1) - (1)].table), NULL,
                                            TL_OPTION_UPDATING,
@@ -32221,7 +32230,7 @@ yyreduce:
   case 1615:
 
 /* Line 1455 of yacc.c  */
-#line 10938 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10947 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!Select->add_table_to_list(thd, (yyvsp[(1) - (1)].table), NULL,
                                            TL_OPTION_UPDATING | TL_OPTION_ALIAS,
@@ -32234,35 +32243,35 @@ yyreduce:
   case 1616:
 
 /* Line 1455 of yacc.c  */
-#line 10948 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10957 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 0; }
     break;
 
   case 1617:
 
 /* Line 1455 of yacc.c  */
-#line 10949 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10958 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 1; }
     break;
 
   case 1618:
 
 /* Line 1455 of yacc.c  */
-#line 10953 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10962 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 0; }
     break;
 
   case 1619:
 
 /* Line 1455 of yacc.c  */
-#line 10954 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10963 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 1; }
     break;
 
   case 1620:
 
 /* Line 1455 of yacc.c  */
-#line 10962 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10971 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_INSERT;
@@ -32274,7 +32283,7 @@ yyreduce:
   case 1621:
 
 /* Line 1455 of yacc.c  */
-#line 10970 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10979 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->set_lock_for_tables((yyvsp[(3) - (5)].lock_type));
             Lex->current_select= &Lex->select_lex;
@@ -32284,14 +32293,14 @@ yyreduce:
   case 1622:
 
 /* Line 1455 of yacc.c  */
-#line 10975 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10984 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1623:
 
 /* Line 1455 of yacc.c  */
-#line 10980 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10989 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command = SQLCOM_REPLACE;
@@ -32303,7 +32312,7 @@ yyreduce:
   case 1624:
 
 /* Line 1455 of yacc.c  */
-#line 10987 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 10996 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->set_lock_for_tables((yyvsp[(3) - (4)].lock_type));
             Lex->current_select= &Lex->select_lex;
@@ -32313,14 +32322,14 @@ yyreduce:
   case 1625:
 
 /* Line 1455 of yacc.c  */
-#line 10992 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11001 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1626:
 
 /* Line 1455 of yacc.c  */
-#line 10997 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11006 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               If it is SP we do not allow insert optimisation when result of
@@ -32334,14 +32343,14 @@ yyreduce:
   case 1627:
 
 /* Line 1455 of yacc.c  */
-#line 11005 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11014 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE_LOW_PRIORITY; }
     break;
 
   case 1628:
 
 /* Line 1455 of yacc.c  */
-#line 11007 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11016 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() -
                                                     thd->query());
@@ -32354,21 +32363,21 @@ yyreduce:
   case 1629:
 
 /* Line 1455 of yacc.c  */
-#line 11014 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11023 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE; }
     break;
 
   case 1630:
 
 /* Line 1455 of yacc.c  */
-#line 11018 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11027 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= (yyvsp[(1) - (1)].lock_type); }
     break;
 
   case 1631:
 
 /* Line 1455 of yacc.c  */
-#line 11020 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11029 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           Lex->keyword_delayed_begin_offset= (uint)(YYLIP->get_tok_start() -
                                                     thd->query());
@@ -32381,21 +32390,21 @@ yyreduce:
   case 1632:
 
 /* Line 1455 of yacc.c  */
-#line 11030 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11039 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1633:
 
 /* Line 1455 of yacc.c  */
-#line 11031 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11040 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1634:
 
 /* Line 1455 of yacc.c  */
-#line 11036 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11045 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->field_list.empty();
@@ -32407,28 +32416,28 @@ yyreduce:
   case 1635:
 
 /* Line 1455 of yacc.c  */
-#line 11044 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11053 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1636:
 
 /* Line 1455 of yacc.c  */
-#line 11045 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11054 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1637:
 
 /* Line 1455 of yacc.c  */
-#line 11046 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11055 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1638:
 
 /* Line 1455 of yacc.c  */
-#line 11048 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11057 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!(lex->insert_list = new List_item) ||
@@ -32440,63 +32449,63 @@ yyreduce:
   case 1640:
 
 /* Line 1455 of yacc.c  */
-#line 11058 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11067 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->field_list.push_back((yyvsp[(3) - (3)].item)); }
     break;
 
   case 1641:
 
 /* Line 1455 of yacc.c  */
-#line 11059 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11068 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->field_list.push_back((yyvsp[(1) - (1)].item)); }
     break;
 
   case 1642:
 
 /* Line 1455 of yacc.c  */
-#line 11063 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11072 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1643:
 
 /* Line 1455 of yacc.c  */
-#line 11064 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11073 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1644:
 
 /* Line 1455 of yacc.c  */
-#line 11066 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11075 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->set_braces(0);}
     break;
 
   case 1645:
 
 /* Line 1455 of yacc.c  */
-#line 11067 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11076 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1646:
 
 /* Line 1455 of yacc.c  */
-#line 11069 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11078 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->set_braces(1);}
     break;
 
   case 1647:
 
 /* Line 1455 of yacc.c  */
-#line 11070 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11079 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1652:
 
 /* Line 1455 of yacc.c  */
-#line 11085 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11094 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->field_list.push_back((yyvsp[(1) - (3)].item)) ||
@@ -32508,35 +32517,35 @@ yyreduce:
   case 1653:
 
 /* Line 1455 of yacc.c  */
-#line 11094 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11103 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1654:
 
 /* Line 1455 of yacc.c  */
-#line 11095 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11104 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1655:
 
 /* Line 1455 of yacc.c  */
-#line 11099 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11108 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1656:
 
 /* Line 1455 of yacc.c  */
-#line 11100 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11109 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1657:
 
 /* Line 1455 of yacc.c  */
-#line 11105 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11114 "/home/buildbot/git/sql/sql_yacc.yy"
     {
               if (!(Lex->insert_list = new List_item))
                 MYSQL_YYABORT;
@@ -32546,7 +32555,7 @@ yyreduce:
   case 1658:
 
 /* Line 1455 of yacc.c  */
-#line 11110 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11119 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->many_values.push_back(lex->insert_list))
@@ -32557,14 +32566,14 @@ yyreduce:
   case 1659:
 
 /* Line 1455 of yacc.c  */
-#line 11118 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11127 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1661:
 
 /* Line 1455 of yacc.c  */
-#line 11124 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11133 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->insert_list->push_back((yyvsp[(3) - (3)].item)))
               MYSQL_YYABORT;
@@ -32574,7 +32583,7 @@ yyreduce:
   case 1662:
 
 /* Line 1455 of yacc.c  */
-#line 11129 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11138 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->insert_list->push_back((yyvsp[(1) - (1)].item)))
               MYSQL_YYABORT;
@@ -32584,14 +32593,14 @@ yyreduce:
   case 1663:
 
 /* Line 1455 of yacc.c  */
-#line 11136 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11145 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)= (yyvsp[(1) - (1)].item);}
     break;
 
   case 1664:
 
 /* Line 1455 of yacc.c  */
-#line 11138 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11147 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_default_value(Lex->current_context());
             if ((yyval.item) == NULL)
@@ -32602,14 +32611,14 @@ yyreduce:
   case 1666:
 
 /* Line 1455 of yacc.c  */
-#line 11147 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11156 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->duplicates= DUP_UPDATE; }
     break;
 
   case 1668:
 
 /* Line 1455 of yacc.c  */
-#line 11155 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11164 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             mysql_init_select(lex);
@@ -32621,7 +32630,7 @@ yyreduce:
   case 1669:
 
 /* Line 1455 of yacc.c  */
-#line 11163 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11172 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->select_lex.table_list.elements > 1)
@@ -32645,14 +32654,14 @@ yyreduce:
   case 1670:
 
 /* Line 1455 of yacc.c  */
-#line 11181 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11190 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1673:
 
 /* Line 1455 of yacc.c  */
-#line 11191 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11200 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (add_item_to_list(thd, (yyvsp[(1) - (3)].item)) || add_value_to_list(thd, (yyvsp[(3) - (3)].item)))
               MYSQL_YYABORT;
@@ -32662,7 +32671,7 @@ yyreduce:
   case 1676:
 
 /* Line 1455 of yacc.c  */
-#line 11204 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11213 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           LEX *lex= Lex;
           if (lex->update_list.push_back((yyvsp[(1) - (3)].item)) || 
@@ -32674,21 +32683,21 @@ yyreduce:
   case 1677:
 
 /* Line 1455 of yacc.c  */
-#line 11213 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11222 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE_DEFAULT; }
     break;
 
   case 1678:
 
 /* Line 1455 of yacc.c  */
-#line 11214 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11223 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE_LOW_PRIORITY; }
     break;
 
   case 1679:
 
 /* Line 1455 of yacc.c  */
-#line 11221 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11230 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_DELETE;
@@ -32704,7 +32713,7 @@ yyreduce:
   case 1681:
 
 /* Line 1455 of yacc.c  */
-#line 11236 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11245 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!Select->add_table_to_list(thd, (yyvsp[(2) - (2)].table), NULL, TL_OPTION_UPDATING,
                                            YYPS->m_lock_type,
@@ -32718,14 +32727,14 @@ yyreduce:
   case 1682:
 
 /* Line 1455 of yacc.c  */
-#line 11245 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11254 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1683:
 
 /* Line 1455 of yacc.c  */
-#line 11247 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11256 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             mysql_init_multi_delete(Lex);
             YYPS->m_lock_type= TL_READ_DEFAULT;
@@ -32736,7 +32745,7 @@ yyreduce:
   case 1684:
 
 /* Line 1455 of yacc.c  */
-#line 11253 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11262 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (multi_delete_set_locks_and_link_aux_tables(Lex))
               MYSQL_YYABORT;
@@ -32746,7 +32755,7 @@ yyreduce:
   case 1685:
 
 /* Line 1455 of yacc.c  */
-#line 11258 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11267 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             mysql_init_multi_delete(Lex);
             YYPS->m_lock_type= TL_READ_DEFAULT;
@@ -32757,7 +32766,7 @@ yyreduce:
   case 1686:
 
 /* Line 1455 of yacc.c  */
-#line 11264 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11273 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (multi_delete_set_locks_and_link_aux_tables(Lex))
               MYSQL_YYABORT;
@@ -32767,7 +32776,7 @@ yyreduce:
   case 1689:
 
 /* Line 1455 of yacc.c  */
-#line 11277 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11286 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Table_ident *ti= new Table_ident((yyvsp[(1) - (2)].lex_str));
             if (ti == NULL)
@@ -32785,7 +32794,7 @@ yyreduce:
   case 1690:
 
 /* Line 1455 of yacc.c  */
-#line 11290 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11299 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Table_ident *ti= new Table_ident(thd, (yyvsp[(1) - (4)].lex_str), (yyvsp[(3) - (4)].lex_str), 0);
             if (ti == NULL)
@@ -32803,56 +32812,56 @@ yyreduce:
   case 1691:
 
 /* Line 1455 of yacc.c  */
-#line 11305 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11314 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1692:
 
 /* Line 1455 of yacc.c  */
-#line 11306 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11315 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1693:
 
 /* Line 1455 of yacc.c  */
-#line 11310 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11319 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1694:
 
 /* Line 1455 of yacc.c  */
-#line 11311 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11320 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1695:
 
 /* Line 1455 of yacc.c  */
-#line 11315 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11324 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= OPTION_QUICK; }
     break;
 
   case 1696:
 
 /* Line 1455 of yacc.c  */
-#line 11316 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11325 "/home/buildbot/git/sql/sql_yacc.yy"
     { YYPS->m_lock_type= TL_WRITE_LOW_PRIORITY; }
     break;
 
   case 1697:
 
 /* Line 1455 of yacc.c  */
-#line 11317 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11326 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ignore= 1; }
     break;
 
   case 1698:
 
 /* Line 1455 of yacc.c  */
-#line 11322 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11331 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX* lex= Lex;
             lex->sql_command= SQLCOM_TRUNCATE;
@@ -32868,7 +32877,7 @@ yyreduce:
   case 1699:
 
 /* Line 1455 of yacc.c  */
-#line 11333 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11342 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX* lex= thd->lex;
             DBUG_ASSERT(!lex->m_stmt);
@@ -32881,7 +32890,7 @@ yyreduce:
   case 1706:
 
 /* Line 1455 of yacc.c  */
-#line 11357 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11366 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_CPU;
     }
@@ -32890,7 +32899,7 @@ yyreduce:
   case 1707:
 
 /* Line 1455 of yacc.c  */
-#line 11361 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11370 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_MEMORY;
     }
@@ -32899,7 +32908,7 @@ yyreduce:
   case 1708:
 
 /* Line 1455 of yacc.c  */
-#line 11365 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11374 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_BLOCK_IO;
     }
@@ -32908,7 +32917,7 @@ yyreduce:
   case 1709:
 
 /* Line 1455 of yacc.c  */
-#line 11369 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11378 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_CONTEXT;
     }
@@ -32917,7 +32926,7 @@ yyreduce:
   case 1710:
 
 /* Line 1455 of yacc.c  */
-#line 11373 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11382 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_PAGE_FAULTS;
     }
@@ -32926,7 +32935,7 @@ yyreduce:
   case 1711:
 
 /* Line 1455 of yacc.c  */
-#line 11377 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11386 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_IPC;
     }
@@ -32935,7 +32944,7 @@ yyreduce:
   case 1712:
 
 /* Line 1455 of yacc.c  */
-#line 11381 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11390 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_SWAPS;
     }
@@ -32944,7 +32953,7 @@ yyreduce:
   case 1713:
 
 /* Line 1455 of yacc.c  */
-#line 11385 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11394 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_SOURCE;
     }
@@ -32953,7 +32962,7 @@ yyreduce:
   case 1714:
 
 /* Line 1455 of yacc.c  */
-#line 11389 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11398 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_options|= PROFILE_ALL;
     }
@@ -32962,7 +32971,7 @@ yyreduce:
   case 1715:
 
 /* Line 1455 of yacc.c  */
-#line 11396 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11405 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_query_id= 0;
     }
@@ -32971,7 +32980,7 @@ yyreduce:
   case 1716:
 
 /* Line 1455 of yacc.c  */
-#line 11400 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11409 "/home/buildbot/git/sql/sql_yacc.yy"
     {
       Lex->profile_query_id= atoi((yyvsp[(3) - (3)].lex_str).str);
     }
@@ -32980,7 +32989,7 @@ yyreduce:
   case 1717:
 
 /* Line 1455 of yacc.c  */
-#line 11409 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11418 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->wild=0;
@@ -32993,7 +33002,7 @@ yyreduce:
   case 1718:
 
 /* Line 1455 of yacc.c  */
-#line 11417 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11426 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= NO_MATTER;
           }
@@ -33002,7 +33011,7 @@ yyreduce:
   case 1719:
 
 /* Line 1455 of yacc.c  */
-#line 11424 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11433 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_DATABASES;
@@ -33014,7 +33023,7 @@ yyreduce:
   case 1720:
 
 /* Line 1455 of yacc.c  */
-#line 11431 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11440 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_TABLES;
@@ -33027,7 +33036,7 @@ yyreduce:
   case 1721:
 
 /* Line 1455 of yacc.c  */
-#line 11439 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11448 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_TRIGGERS;
@@ -33040,7 +33049,7 @@ yyreduce:
   case 1722:
 
 /* Line 1455 of yacc.c  */
-#line 11447 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11456 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_EVENTS;
@@ -33053,7 +33062,7 @@ yyreduce:
   case 1723:
 
 /* Line 1455 of yacc.c  */
-#line 11455 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11464 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
@@ -33066,7 +33075,7 @@ yyreduce:
   case 1724:
 
 /* Line 1455 of yacc.c  */
-#line 11463 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11472 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
@@ -33079,7 +33088,7 @@ yyreduce:
   case 1725:
 
 /* Line 1455 of yacc.c  */
-#line 11471 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11480 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_PLUGINS;
@@ -33091,21 +33100,21 @@ yyreduce:
   case 1726:
 
 /* Line 1455 of yacc.c  */
-#line 11478 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11487 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_info.db_type= (yyvsp[(2) - (3)].db_type); }
     break;
 
   case 1727:
 
 /* Line 1455 of yacc.c  */
-#line 11480 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11489 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_info.db_type= NULL; }
     break;
 
   case 1728:
 
 /* Line 1455 of yacc.c  */
-#line 11482 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11491 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_FIELDS;
@@ -33119,7 +33128,7 @@ yyreduce:
   case 1729:
 
 /* Line 1455 of yacc.c  */
-#line 11491 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11500 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_SHOW_BINLOGS;
           }
@@ -33128,7 +33137,7 @@ yyreduce:
   case 1730:
 
 /* Line 1455 of yacc.c  */
-#line 11495 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11504 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_SHOW_SLAVE_HOSTS;
           }
@@ -33137,7 +33146,7 @@ yyreduce:
   case 1731:
 
 /* Line 1455 of yacc.c  */
-#line 11499 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11508 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
@@ -33147,7 +33156,7 @@ yyreduce:
   case 1733:
 
 /* Line 1455 of yacc.c  */
-#line 11504 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11513 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS;
@@ -33157,7 +33166,7 @@ yyreduce:
   case 1735:
 
 /* Line 1455 of yacc.c  */
-#line 11509 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11518 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_KEYS;
@@ -33171,7 +33180,7 @@ yyreduce:
   case 1736:
 
 /* Line 1455 of yacc.c  */
-#line 11518 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11527 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
@@ -33183,7 +33192,7 @@ yyreduce:
   case 1737:
 
 /* Line 1455 of yacc.c  */
-#line 11525 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11534 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_AUTHORS;
@@ -33197,7 +33206,7 @@ yyreduce:
   case 1738:
 
 /* Line 1455 of yacc.c  */
-#line 11534 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11543 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_CONTRIBUTORS;
@@ -33211,7 +33220,7 @@ yyreduce:
   case 1739:
 
 /* Line 1455 of yacc.c  */
-#line 11543 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11552 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_PRIVILEGES;
@@ -33221,42 +33230,42 @@ yyreduce:
   case 1740:
 
 /* Line 1455 of yacc.c  */
-#line 11548 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11557 "/home/buildbot/git/sql/sql_yacc.yy"
     { (void) create_select_for_variable("warning_count"); }
     break;
 
   case 1741:
 
 /* Line 1455 of yacc.c  */
-#line 11550 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11559 "/home/buildbot/git/sql/sql_yacc.yy"
     { (void) create_select_for_variable("error_count"); }
     break;
 
   case 1742:
 
 /* Line 1455 of yacc.c  */
-#line 11552 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11561 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command = SQLCOM_SHOW_WARNS;}
     break;
 
   case 1743:
 
 /* Line 1455 of yacc.c  */
-#line 11554 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11563 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command = SQLCOM_SHOW_ERRORS;}
     break;
 
   case 1744:
 
 /* Line 1455 of yacc.c  */
-#line 11556 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11565 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command = SQLCOM_SHOW_PROFILES; }
     break;
 
   case 1745:
 
 /* Line 1455 of yacc.c  */
-#line 11558 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11567 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_PROFILE;
@@ -33268,7 +33277,7 @@ yyreduce:
   case 1746:
 
 /* Line 1455 of yacc.c  */
-#line 11565 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11574 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_STATUS;
@@ -33281,14 +33290,14 @@ yyreduce:
   case 1747:
 
 /* Line 1455 of yacc.c  */
-#line 11573 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11582 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
     break;
 
   case 1748:
 
 /* Line 1455 of yacc.c  */
-#line 11575 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11584 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_VARIABLES;
@@ -33301,7 +33310,7 @@ yyreduce:
   case 1749:
 
 /* Line 1455 of yacc.c  */
-#line 11583 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11592 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_CHARSETS;
@@ -33313,7 +33322,7 @@ yyreduce:
   case 1750:
 
 /* Line 1455 of yacc.c  */
-#line 11590 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11599 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_COLLATIONS;
@@ -33325,7 +33334,7 @@ yyreduce:
   case 1751:
 
 /* Line 1455 of yacc.c  */
-#line 11597 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11606 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_GRANTS;
@@ -33340,7 +33349,7 @@ yyreduce:
   case 1752:
 
 /* Line 1455 of yacc.c  */
-#line 11607 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11616 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SHOW_GRANTS;
@@ -33352,7 +33361,7 @@ yyreduce:
   case 1753:
 
 /* Line 1455 of yacc.c  */
-#line 11614 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11623 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command=SQLCOM_SHOW_CREATE_DB;
             Lex->create_info.options=(yyvsp[(3) - (4)].num);
@@ -33363,7 +33372,7 @@ yyreduce:
   case 1754:
 
 /* Line 1455 of yacc.c  */
-#line 11620 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11629 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command = SQLCOM_SHOW_CREATE;
@@ -33376,7 +33385,7 @@ yyreduce:
   case 1755:
 
 /* Line 1455 of yacc.c  */
-#line 11628 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11637 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command = SQLCOM_SHOW_CREATE;
@@ -33389,7 +33398,7 @@ yyreduce:
   case 1756:
 
 /* Line 1455 of yacc.c  */
-#line 11636 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11645 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_SHOW_MASTER_STAT;
           }
@@ -33398,7 +33407,7 @@ yyreduce:
   case 1757:
 
 /* Line 1455 of yacc.c  */
-#line 11640 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11649 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
           }
@@ -33407,7 +33416,7 @@ yyreduce:
   case 1758:
 
 /* Line 1455 of yacc.c  */
-#line 11644 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11653 "/home/buildbot/git/sql/sql_yacc.yy"
     {
            LEX *lex= Lex;
            lex->sql_command= SQLCOM_SHOW_CLIENT_STATS;
@@ -33419,7 +33428,7 @@ yyreduce:
   case 1759:
 
 /* Line 1455 of yacc.c  */
-#line 11651 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11660 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_USER_STATS;
@@ -33431,7 +33440,7 @@ yyreduce:
   case 1760:
 
 /* Line 1455 of yacc.c  */
-#line 11658 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11667 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_TABLE_STATS;
@@ -33443,7 +33452,7 @@ yyreduce:
   case 1761:
 
 /* Line 1455 of yacc.c  */
-#line 11665 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11674 "/home/buildbot/git/sql/sql_yacc.yy"
     {
              LEX *lex= Lex;
              lex->sql_command= SQLCOM_SHOW_INDEX_STATS;
@@ -33455,7 +33464,7 @@ yyreduce:
   case 1762:
 
 /* Line 1455 of yacc.c  */
-#line 11672 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11681 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
 
@@ -33467,7 +33476,7 @@ yyreduce:
   case 1763:
 
 /* Line 1455 of yacc.c  */
-#line 11679 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11688 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
 
@@ -33479,7 +33488,7 @@ yyreduce:
   case 1764:
 
 /* Line 1455 of yacc.c  */
-#line 11686 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11695 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER;
@@ -33490,7 +33499,7 @@ yyreduce:
   case 1765:
 
 /* Line 1455 of yacc.c  */
-#line 11692 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11701 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_STATUS_PROC;
@@ -33502,7 +33511,7 @@ yyreduce:
   case 1766:
 
 /* Line 1455 of yacc.c  */
-#line 11699 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11708 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_SHOW_STATUS_FUNC;
@@ -33514,7 +33523,7 @@ yyreduce:
   case 1767:
 
 /* Line 1455 of yacc.c  */
-#line 11706 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11715 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command= SQLCOM_SHOW_PROC_CODE;
             Lex->spname= (yyvsp[(3) - (3)].spname);
@@ -33524,7 +33533,7 @@ yyreduce:
   case 1768:
 
 /* Line 1455 of yacc.c  */
-#line 11711 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11720 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
             Lex->spname= (yyvsp[(3) - (3)].spname);
@@ -33534,7 +33543,7 @@ yyreduce:
   case 1769:
 
 /* Line 1455 of yacc.c  */
-#line 11716 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11725 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->spname= (yyvsp[(3) - (3)].spname);
             Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
@@ -33544,84 +33553,84 @@ yyreduce:
   case 1770:
 
 /* Line 1455 of yacc.c  */
-#line 11724 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11733 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command= SQLCOM_SHOW_ENGINE_STATUS; }
     break;
 
   case 1771:
 
 /* Line 1455 of yacc.c  */
-#line 11726 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11735 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command= SQLCOM_SHOW_ENGINE_MUTEX; }
     break;
 
   case 1772:
 
 /* Line 1455 of yacc.c  */
-#line 11728 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11737 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->sql_command= SQLCOM_SHOW_ENGINE_LOGS; }
     break;
 
   case 1777:
 
 /* Line 1455 of yacc.c  */
-#line 11742 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11751 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.simple_string)= 0; }
     break;
 
   case 1778:
 
 /* Line 1455 of yacc.c  */
-#line 11743 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11752 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.simple_string)= (yyvsp[(2) - (2)].lex_str).str; }
     break;
 
   case 1779:
 
 /* Line 1455 of yacc.c  */
-#line 11747 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11756 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->verbose=0; }
     break;
 
   case 1780:
 
 /* Line 1455 of yacc.c  */
-#line 11748 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11757 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->verbose=1; }
     break;
 
   case 1783:
 
 /* Line 1455 of yacc.c  */
-#line 11757 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11766 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->mi.log_file_name = 0; }
     break;
 
   case 1784:
 
 /* Line 1455 of yacc.c  */
-#line 11758 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11767 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->mi.log_file_name = (yyvsp[(2) - (2)].lex_str).str; }
     break;
 
   case 1785:
 
 /* Line 1455 of yacc.c  */
-#line 11762 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11771 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->mi.pos = 4; /* skip magic number */ }
     break;
 
   case 1786:
 
 /* Line 1455 of yacc.c  */
-#line 11763 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11772 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->mi.pos = (yyvsp[(2) - (2)].ulonglong_number); }
     break;
 
   case 1788:
 
 /* Line 1455 of yacc.c  */
-#line 11769 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11778 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->wild= new (thd->mem_root) String((yyvsp[(2) - (2)].lex_str).str, (yyvsp[(2) - (2)].lex_str).length,
                                                     system_charset_info);
@@ -33633,7 +33642,7 @@ yyreduce:
   case 1789:
 
 /* Line 1455 of yacc.c  */
-#line 11776 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11785 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->where= normalize_cond((yyvsp[(2) - (2)].item));
             if ((yyvsp[(2) - (2)].item))
@@ -33644,7 +33653,7 @@ yyreduce:
   case 1790:
 
 /* Line 1455 of yacc.c  */
-#line 11786 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11795 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             mysql_init_select(lex);
@@ -33660,7 +33669,7 @@ yyreduce:
   case 1791:
 
 /* Line 1455 of yacc.c  */
-#line 11797 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11806 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Select->parsing_place= NO_MATTER;
           }
@@ -33669,14 +33678,14 @@ yyreduce:
   case 1792:
 
 /* Line 1455 of yacc.c  */
-#line 11801 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11810 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->describe|= DESCRIBE_NORMAL; }
     break;
 
   case 1793:
 
 /* Line 1455 of yacc.c  */
-#line 11803 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11812 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->select_lex.options|= SELECT_DESCRIBE;
@@ -33686,42 +33695,42 @@ yyreduce:
   case 1796:
 
 /* Line 1455 of yacc.c  */
-#line 11815 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11824 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1797:
 
 /* Line 1455 of yacc.c  */
-#line 11816 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11825 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->describe|= DESCRIBE_EXTENDED; }
     break;
 
   case 1798:
 
 /* Line 1455 of yacc.c  */
-#line 11817 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11826 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->describe|= DESCRIBE_PARTITIONS; }
     break;
 
   case 1799:
 
 /* Line 1455 of yacc.c  */
-#line 11821 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11830 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1800:
 
 /* Line 1455 of yacc.c  */
-#line 11822 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11831 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->wild= (yyvsp[(1) - (1)].string); }
     break;
 
   case 1801:
 
 /* Line 1455 of yacc.c  */
-#line 11824 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11833 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->wild= new (thd->mem_root) String((const char*) (yyvsp[(1) - (1)].lex_str).str,
                                                     (yyvsp[(1) - (1)].lex_str).length,
@@ -33734,7 +33743,7 @@ yyreduce:
   case 1802:
 
 /* Line 1455 of yacc.c  */
-#line 11838 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11847 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_FLUSH;
@@ -33746,14 +33755,14 @@ yyreduce:
   case 1803:
 
 /* Line 1455 of yacc.c  */
-#line 11845 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11854 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1804:
 
 /* Line 1455 of yacc.c  */
-#line 11850 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11859 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->type|= REFRESH_TABLES;
             /*
@@ -33768,28 +33777,28 @@ yyreduce:
   case 1805:
 
 /* Line 1455 of yacc.c  */
-#line 11859 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11868 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1806:
 
 /* Line 1455 of yacc.c  */
-#line 11860 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11869 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1808:
 
 /* Line 1455 of yacc.c  */
-#line 11865 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11874 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1809:
 
 /* Line 1455 of yacc.c  */
-#line 11867 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11876 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             TABLE_LIST *tables= Lex->query_tables;
             Lex->type|= REFRESH_READ_LOCK | (yyvsp[(4) - (4)].num);
@@ -33805,91 +33814,91 @@ yyreduce:
   case 1811:
 
 /* Line 1455 of yacc.c  */
-#line 11882 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11891 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1812:
 
 /* Line 1455 of yacc.c  */
-#line 11887 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11896 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_ERROR_LOG; }
     break;
 
   case 1813:
 
 /* Line 1455 of yacc.c  */
-#line 11889 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11898 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_ENGINE_LOG; }
     break;
 
   case 1814:
 
 /* Line 1455 of yacc.c  */
-#line 11891 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11900 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_GENERAL_LOG; }
     break;
 
   case 1815:
 
 /* Line 1455 of yacc.c  */
-#line 11893 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11902 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_SLOW_LOG; }
     break;
 
   case 1816:
 
 /* Line 1455 of yacc.c  */
-#line 11895 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11904 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_BINARY_LOG; }
     break;
 
   case 1817:
 
 /* Line 1455 of yacc.c  */
-#line 11897 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11906 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_RELAY_LOG; }
     break;
 
   case 1818:
 
 /* Line 1455 of yacc.c  */
-#line 11899 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11908 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_QUERY_CACHE_FREE; }
     break;
 
   case 1819:
 
 /* Line 1455 of yacc.c  */
-#line 11901 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11910 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_HOSTS; }
     break;
 
   case 1820:
 
 /* Line 1455 of yacc.c  */
-#line 11903 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11912 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_GRANT; }
     break;
 
   case 1821:
 
 /* Line 1455 of yacc.c  */
-#line 11905 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11914 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_LOG; }
     break;
 
   case 1822:
 
 /* Line 1455 of yacc.c  */
-#line 11907 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11916 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_STATUS; }
     break;
 
   case 1823:
 
 /* Line 1455 of yacc.c  */
-#line 11909 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11918 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             Lex->type|= REFRESH_SLAVE;
             Lex->reset_slave_info.all= false;
@@ -33899,84 +33908,84 @@ yyreduce:
   case 1824:
 
 /* Line 1455 of yacc.c  */
-#line 11914 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11923 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_CLIENT_STATS; }
     break;
 
   case 1825:
 
 /* Line 1455 of yacc.c  */
-#line 11916 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11925 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_USER_STATS; }
     break;
 
   case 1826:
 
 /* Line 1455 of yacc.c  */
-#line 11918 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11927 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_TABLE_STATS; }
     break;
 
   case 1827:
 
 /* Line 1455 of yacc.c  */
-#line 11920 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11929 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_INDEX_STATS; }
     break;
 
   case 1828:
 
 /* Line 1455 of yacc.c  */
-#line 11922 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11931 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_MASTER; }
     break;
 
   case 1829:
 
 /* Line 1455 of yacc.c  */
-#line 11924 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11933 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_DES_KEY_FILE; }
     break;
 
   case 1830:
 
 /* Line 1455 of yacc.c  */
-#line 11926 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11935 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_USER_RESOURCES; }
     break;
 
   case 1831:
 
 /* Line 1455 of yacc.c  */
-#line 11930 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11939 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1832:
 
 /* Line 1455 of yacc.c  */
-#line 11931 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11940 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1833:
 
 /* Line 1455 of yacc.c  */
-#line 11935 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11944 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.num)= 0;}
     break;
 
   case 1834:
 
 /* Line 1455 of yacc.c  */
-#line 11936 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11945 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.num)= REFRESH_CHECKPOINT; }
     break;
 
   case 1835:
 
 /* Line 1455 of yacc.c  */
-#line 11940 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11949 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_RESET; lex->type=0;
@@ -33986,56 +33995,56 @@ yyreduce:
   case 1836:
 
 /* Line 1455 of yacc.c  */
-#line 11945 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11954 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1839:
 
 /* Line 1455 of yacc.c  */
-#line 11954 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11963 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_SLAVE; }
     break;
 
   case 1840:
 
 /* Line 1455 of yacc.c  */
-#line 11955 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11964 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 1841:
 
 /* Line 1455 of yacc.c  */
-#line 11956 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11965 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_MASTER; }
     break;
 
   case 1842:
 
 /* Line 1455 of yacc.c  */
-#line 11957 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11966 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->type|= REFRESH_QUERY_CACHE;}
     break;
 
   case 1843:
 
 /* Line 1455 of yacc.c  */
-#line 11961 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11970 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->reset_slave_info.all= false; }
     break;
 
   case 1844:
 
 /* Line 1455 of yacc.c  */
-#line 11962 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11971 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->reset_slave_info.all= true; }
     break;
 
   case 1845:
 
 /* Line 1455 of yacc.c  */
-#line 11967 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11976 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->type=0;
@@ -34046,14 +34055,14 @@ yyreduce:
   case 1846:
 
 /* Line 1455 of yacc.c  */
-#line 11973 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11982 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1848:
 
 /* Line 1455 of yacc.c  */
-#line 11982 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11991 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->to_log = (yyvsp[(2) - (2)].lex_str).str;
           }
@@ -34062,7 +34071,7 @@ yyreduce:
   case 1849:
 
 /* Line 1455 of yacc.c  */
-#line 11986 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 11995 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->value_list.empty();
@@ -34074,7 +34083,7 @@ yyreduce:
   case 1850:
 
 /* Line 1455 of yacc.c  */
-#line 11998 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12007 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->value_list.empty();
@@ -34086,7 +34095,7 @@ yyreduce:
   case 1851:
 
 /* Line 1455 of yacc.c  */
-#line 12005 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12014 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->kill_signal= (killed_state) ((yyvsp[(3) - (5)].num) | (yyvsp[(4) - (5)].num));
           }
@@ -34095,49 +34104,49 @@ yyreduce:
   case 1852:
 
 /* Line 1455 of yacc.c  */
-#line 12011 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12020 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= (int) KILL_HARD_BIT; }
     break;
 
   case 1853:
 
 /* Line 1455 of yacc.c  */
-#line 12012 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12021 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= (int) KILL_HARD_BIT; }
     break;
 
   case 1854:
 
 /* Line 1455 of yacc.c  */
-#line 12013 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12022 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 0; }
     break;
 
   case 1855:
 
 /* Line 1455 of yacc.c  */
-#line 12016 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12025 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= (int) KILL_CONNECTION; }
     break;
 
   case 1856:
 
 /* Line 1455 of yacc.c  */
-#line 12017 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12026 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= (int) KILL_CONNECTION; }
     break;
 
   case 1857:
 
 /* Line 1455 of yacc.c  */
-#line 12018 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12027 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= (int) KILL_QUERY; }
     break;
 
   case 1858:
 
 /* Line 1455 of yacc.c  */
-#line 12023 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12032 "/home/buildbot/git/sql/sql_yacc.yy"
     {
           Lex->value_list.push_front((yyval.item));
           Lex->kill_type= KILL_TYPE_ID;
@@ -34147,7 +34156,7 @@ yyreduce:
   case 1859:
 
 /* Line 1455 of yacc.c  */
-#line 12028 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12037 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->users_list.push_back((yyvsp[(2) - (2)].lex_user));
             Lex->kill_type= KILL_TYPE_USER;
@@ -34157,7 +34166,7 @@ yyreduce:
   case 1860:
 
 /* Line 1455 of yacc.c  */
-#line 12038 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12047 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command=SQLCOM_CHANGE_DB;
@@ -34168,7 +34177,7 @@ yyreduce:
   case 1861:
 
 /* Line 1455 of yacc.c  */
-#line 12049 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12058 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
 
@@ -34184,7 +34193,7 @@ yyreduce:
   case 1862:
 
 /* Line 1455 of yacc.c  */
-#line 12060 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12069 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_LOAD;
@@ -34199,7 +34208,7 @@ yyreduce:
   case 1863:
 
 /* Line 1455 of yacc.c  */
-#line 12070 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12079 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!Select->add_table_to_list(thd, (yyvsp[(12) - (12)].table), NULL, TL_OPTION_UPDATING,
@@ -34214,56 +34223,56 @@ yyreduce:
   case 1864:
 
 /* Line 1455 of yacc.c  */
-#line 12080 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12089 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->exchange->cs= (yyvsp[(14) - (14)].charset); }
     break;
 
   case 1865:
 
 /* Line 1455 of yacc.c  */
-#line 12084 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12093 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1866:
 
 /* Line 1455 of yacc.c  */
-#line 12088 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12097 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.filetype)= FILETYPE_CSV; }
     break;
 
   case 1867:
 
 /* Line 1455 of yacc.c  */
-#line 12089 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12098 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.filetype)= FILETYPE_XML; }
     break;
 
   case 1868:
 
 /* Line 1455 of yacc.c  */
-#line 12093 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12102 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)=0;}
     break;
 
   case 1869:
 
 /* Line 1455 of yacc.c  */
-#line 12094 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12103 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)=1;}
     break;
 
   case 1870:
 
 /* Line 1455 of yacc.c  */
-#line 12098 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12107 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE_DEFAULT; }
     break;
 
   case 1871:
 
 /* Line 1455 of yacc.c  */
-#line 12100 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12109 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               Ignore this option in SP to avoid problem with query cache and
@@ -34276,35 +34285,35 @@ yyreduce:
   case 1872:
 
 /* Line 1455 of yacc.c  */
-#line 12107 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12116 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lock_type)= TL_WRITE_LOW_PRIORITY; }
     break;
 
   case 1873:
 
 /* Line 1455 of yacc.c  */
-#line 12111 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12120 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->duplicates=DUP_ERROR; }
     break;
 
   case 1874:
 
 /* Line 1455 of yacc.c  */
-#line 12112 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12121 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->duplicates=DUP_REPLACE; }
     break;
 
   case 1875:
 
 /* Line 1455 of yacc.c  */
-#line 12113 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12122 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ignore= 1; }
     break;
 
   case 1880:
 
 /* Line 1455 of yacc.c  */
-#line 12128 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12137 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->field_term= (yyvsp[(3) - (3)].string);
@@ -34314,7 +34323,7 @@ yyreduce:
   case 1881:
 
 /* Line 1455 of yacc.c  */
-#line 12133 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12142 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             DBUG_ASSERT(lex->exchange != 0);
@@ -34326,7 +34335,7 @@ yyreduce:
   case 1882:
 
 /* Line 1455 of yacc.c  */
-#line 12140 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12149 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->enclosed= (yyvsp[(3) - (3)].string);
@@ -34336,7 +34345,7 @@ yyreduce:
   case 1883:
 
 /* Line 1455 of yacc.c  */
-#line 12145 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12154 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->escaped= (yyvsp[(3) - (3)].string);
@@ -34346,7 +34355,7 @@ yyreduce:
   case 1888:
 
 /* Line 1455 of yacc.c  */
-#line 12163 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12172 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->line_term= (yyvsp[(3) - (3)].string);
@@ -34356,7 +34365,7 @@ yyreduce:
   case 1889:
 
 /* Line 1455 of yacc.c  */
-#line 12168 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12177 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->line_start= (yyvsp[(3) - (3)].string);
@@ -34366,21 +34375,21 @@ yyreduce:
   case 1890:
 
 /* Line 1455 of yacc.c  */
-#line 12175 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12184 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 1891:
 
 /* Line 1455 of yacc.c  */
-#line 12177 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12186 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->exchange->line_term = (yyvsp[(4) - (4)].string); }
     break;
 
   case 1893:
 
 /* Line 1455 of yacc.c  */
-#line 12182 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12191 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             DBUG_ASSERT(Lex->exchange != 0);
             Lex->exchange->skip_lines= atol((yyvsp[(2) - (3)].lex_str).str);
@@ -34390,63 +34399,63 @@ yyreduce:
   case 1894:
 
 /* Line 1455 of yacc.c  */
-#line 12189 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12198 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 1895:
 
 /* Line 1455 of yacc.c  */
-#line 12191 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12200 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 1896:
 
 /* Line 1455 of yacc.c  */
-#line 12195 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12204 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1897:
 
 /* Line 1455 of yacc.c  */
-#line 12196 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12205 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1898:
 
 /* Line 1455 of yacc.c  */
-#line 12197 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12206 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1899:
 
 /* Line 1455 of yacc.c  */
-#line 12202 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12211 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->field_list.push_back((yyvsp[(3) - (3)].item)); }
     break;
 
   case 1900:
 
 /* Line 1455 of yacc.c  */
-#line 12204 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12213 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->field_list.push_back((yyvsp[(1) - (1)].item)); }
     break;
 
   case 1901:
 
 /* Line 1455 of yacc.c  */
-#line 12208 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12217 "/home/buildbot/git/sql/sql_yacc.yy"
     {(yyval.item)= (yyvsp[(1) - (1)].item);}
     break;
 
   case 1902:
 
 /* Line 1455 of yacc.c  */
-#line 12210 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12219 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_user_var_as_out_param((yyvsp[(2) - (2)].lex_str));
             if ((yyval.item) == NULL)
@@ -34457,21 +34466,21 @@ yyreduce:
   case 1903:
 
 /* Line 1455 of yacc.c  */
-#line 12218 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12227 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1904:
 
 /* Line 1455 of yacc.c  */
-#line 12219 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12228 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1907:
 
 /* Line 1455 of yacc.c  */
-#line 12229 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12238 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->update_list.push_back((yyvsp[(1) - (5)].item)) || 
@@ -34484,7 +34493,7 @@ yyreduce:
   case 1908:
 
 /* Line 1455 of yacc.c  */
-#line 12242 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12251 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX_STRING tmp;
             CHARSET_INFO *cs_con= thd->variables.collation_connection;
@@ -34512,7 +34521,7 @@ yyreduce:
   case 1909:
 
 /* Line 1455 of yacc.c  */
-#line 12265 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12274 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             uint repertoire= Lex->text_string_is_7bit ?
                              MY_REPERTOIRE_ASCII : MY_REPERTOIRE_UNICODE30;
@@ -34529,7 +34538,7 @@ yyreduce:
   case 1910:
 
 /* Line 1455 of yacc.c  */
-#line 12277 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12286 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item_string *str= new (thd->mem_root) Item_string((yyvsp[(2) - (2)].lex_str).str,
                                                                 (yyvsp[(2) - (2)].lex_str).length, (yyvsp[(1) - (2)].charset));
@@ -34545,7 +34554,7 @@ yyreduce:
   case 1911:
 
 /* Line 1455 of yacc.c  */
-#line 12288 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12297 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item_string* item= (Item_string*) (yyvsp[(1) - (2)].item);
             item->append((yyvsp[(2) - (2)].lex_str).str, (yyvsp[(2) - (2)].lex_str).length);
@@ -34566,7 +34575,7 @@ yyreduce:
   case 1912:
 
 /* Line 1455 of yacc.c  */
-#line 12307 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12316 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.string)= new (thd->mem_root) String((yyvsp[(1) - (1)].lex_str).str,
                                              (yyvsp[(1) - (1)].lex_str).length,
@@ -34579,7 +34588,7 @@ yyreduce:
   case 1913:
 
 /* Line 1455 of yacc.c  */
-#line 12315 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12324 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item *tmp= new (thd->mem_root) Item_hex_hybrid((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if (tmp == NULL)
@@ -34596,7 +34605,7 @@ yyreduce:
   case 1914:
 
 /* Line 1455 of yacc.c  */
-#line 12327 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12336 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item *tmp= new (thd->mem_root) Item_hex_string((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if (tmp == NULL)
@@ -34609,7 +34618,7 @@ yyreduce:
   case 1915:
 
 /* Line 1455 of yacc.c  */
-#line 12335 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12344 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item *tmp= new (thd->mem_root) Item_bin_string((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if (tmp == NULL)
@@ -34626,7 +34635,7 @@ yyreduce:
   case 1916:
 
 /* Line 1455 of yacc.c  */
-#line 12350 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12359 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -34648,21 +34657,21 @@ yyreduce:
   case 1917:
 
 /* Line 1455 of yacc.c  */
-#line 12369 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12378 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(1) - (1)].item); }
     break;
 
   case 1918:
 
 /* Line 1455 of yacc.c  */
-#line 12370 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12379 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(2) - (2)].item_num); }
     break;
 
   case 1919:
 
 /* Line 1455 of yacc.c  */
-#line 12372 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12381 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyvsp[(2) - (2)].item_num)->max_length++;
             (yyval.item)= (yyvsp[(2) - (2)].item_num)->neg();
@@ -34672,21 +34681,21 @@ yyreduce:
   case 1920:
 
 /* Line 1455 of yacc.c  */
-#line 12379 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12388 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(1) - (1)].item); }
     break;
 
   case 1921:
 
 /* Line 1455 of yacc.c  */
-#line 12380 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12389 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(1) - (1)].item_num); }
     break;
 
   case 1922:
 
 /* Line 1455 of yacc.c  */
-#line 12382 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12391 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item) = new (thd->mem_root) Item_null();
             if ((yyval.item) == NULL)
@@ -34698,7 +34707,7 @@ yyreduce:
   case 1923:
 
 /* Line 1455 of yacc.c  */
-#line 12389 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12398 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_int((char*) "FALSE",0,1);
             if ((yyval.item) == NULL)
@@ -34709,7 +34718,7 @@ yyreduce:
   case 1924:
 
 /* Line 1455 of yacc.c  */
-#line 12395 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12404 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_int((char*) "TRUE",1,1);
             if ((yyval.item) == NULL)
@@ -34720,7 +34729,7 @@ yyreduce:
   case 1925:
 
 /* Line 1455 of yacc.c  */
-#line 12401 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12410 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item) = new (thd->mem_root) Item_hex_hybrid((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -34731,7 +34740,7 @@ yyreduce:
   case 1926:
 
 /* Line 1455 of yacc.c  */
-#line 12407 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12416 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item) = new (thd->mem_root) Item_hex_string((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -34742,7 +34751,7 @@ yyreduce:
   case 1927:
 
 /* Line 1455 of yacc.c  */
-#line 12413 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12422 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)= new (thd->mem_root) Item_bin_string((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item) == NULL)
@@ -34753,7 +34762,7 @@ yyreduce:
   case 1928:
 
 /* Line 1455 of yacc.c  */
-#line 12419 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12428 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item *tmp= new (thd->mem_root) Item_hex_string((yyvsp[(2) - (2)].lex_str).str, (yyvsp[(2) - (2)].lex_str).length);
             if (tmp == NULL)
@@ -34787,7 +34796,7 @@ yyreduce:
   case 1929:
 
 /* Line 1455 of yacc.c  */
-#line 12448 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12457 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item *tmp= new (thd->mem_root) Item_bin_string((yyvsp[(2) - (2)].lex_str).str, (yyvsp[(2) - (2)].lex_str).length);
             if (tmp == NULL)
@@ -34820,28 +34829,28 @@ yyreduce:
   case 1930:
 
 /* Line 1455 of yacc.c  */
-#line 12475 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12484 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(2) - (2)].item); }
     break;
 
   case 1931:
 
 /* Line 1455 of yacc.c  */
-#line 12476 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12485 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(2) - (2)].item); }
     break;
 
   case 1932:
 
 /* Line 1455 of yacc.c  */
-#line 12477 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12486 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item) = (yyvsp[(2) - (2)].item); }
     break;
 
   case 1933:
 
 /* Line 1455 of yacc.c  */
-#line 12482 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12491 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             int error;
             (yyval.item_num)= new (thd->mem_root)
@@ -34856,7 +34865,7 @@ yyreduce:
   case 1934:
 
 /* Line 1455 of yacc.c  */
-#line 12492 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12501 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             int error;
             (yyval.item_num)= new (thd->mem_root)
@@ -34871,7 +34880,7 @@ yyreduce:
   case 1935:
 
 /* Line 1455 of yacc.c  */
-#line 12502 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12511 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item_num)= new (thd->mem_root) Item_uint((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if ((yyval.item_num) == NULL)
@@ -34882,7 +34891,7 @@ yyreduce:
   case 1936:
 
 /* Line 1455 of yacc.c  */
-#line 12508 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12517 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item_num)= new (thd->mem_root) Item_decimal((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length,
                                                    thd->charset());
@@ -34896,7 +34905,7 @@ yyreduce:
   case 1937:
 
 /* Line 1455 of yacc.c  */
-#line 12517 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12526 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item_num)= new (thd->mem_root) Item_float((yyvsp[(1) - (1)].lex_str).str, (yyvsp[(1) - (1)].lex_str).length);
             if (((yyval.item_num) == NULL) || (thd->is_error()))
@@ -34909,21 +34918,21 @@ yyreduce:
   case 1938:
 
 /* Line 1455 of yacc.c  */
-#line 12531 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12540 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)=(yyvsp[(1) - (1)].item); }
     break;
 
   case 1939:
 
 /* Line 1455 of yacc.c  */
-#line 12532 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12541 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)=(yyvsp[(1) - (1)].item); }
     break;
 
   case 1940:
 
 /* Line 1455 of yacc.c  */
-#line 12537 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12546 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             (yyval.item)= new (thd->mem_root) Item_field(Lex->current_context(),
@@ -34937,7 +34946,7 @@ yyreduce:
   case 1941:
 
 /* Line 1455 of yacc.c  */
-#line 12546 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12555 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel= Select;
             const char* schema= thd->client_capabilities & CLIENT_NO_SCHEMA ?
@@ -34954,14 +34963,14 @@ yyreduce:
   case 1942:
 
 /* Line 1455 of yacc.c  */
-#line 12560 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12569 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)=(yyvsp[(1) - (1)].item); }
     break;
 
   case 1943:
 
 /* Line 1455 of yacc.c  */
-#line 12565 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12574 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -35012,14 +35021,14 @@ yyreduce:
   case 1944:
 
 /* Line 1455 of yacc.c  */
-#line 12610 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12619 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)= (yyvsp[(1) - (1)].item); }
     break;
 
   case 1945:
 
 /* Line 1455 of yacc.c  */
-#line 12615 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12624 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             SELECT_LEX *sel=Select;
             if ((sel->parsing_place != IN_HAVING) ||
@@ -35041,14 +35050,14 @@ yyreduce:
   case 1946:
 
 /* Line 1455 of yacc.c  */
-#line 12631 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12640 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)= (yyvsp[(1) - (1)].item); }
     break;
 
   case 1947:
 
 /* Line 1455 of yacc.c  */
-#line 12636 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12645 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
 
@@ -35131,7 +35140,7 @@ yyreduce:
   case 1948:
 
 /* Line 1455 of yacc.c  */
-#line 12714 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12723 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             SELECT_LEX *sel= lex->current_select;
@@ -35160,7 +35169,7 @@ yyreduce:
   case 1949:
 
 /* Line 1455 of yacc.c  */
-#line 12738 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12747 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             SELECT_LEX *sel= lex->current_select;
@@ -35192,14 +35201,14 @@ yyreduce:
   case 1950:
 
 /* Line 1455 of yacc.c  */
-#line 12767 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12776 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str);}
     break;
 
   case 1951:
 
 /* Line 1455 of yacc.c  */
-#line 12769 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12778 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             TABLE_LIST *table= Select->table_list.first;
             if (my_strcasecmp(table_alias_charset, (yyvsp[(1) - (5)].lex_str).str, table->db))
@@ -35220,7 +35229,7 @@ yyreduce:
   case 1952:
 
 /* Line 1455 of yacc.c  */
-#line 12785 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12794 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             TABLE_LIST *table= Select->table_list.first;
             if (my_strcasecmp(table_alias_charset, (yyvsp[(1) - (3)].lex_str).str, table->alias))
@@ -35235,14 +35244,14 @@ yyreduce:
   case 1953:
 
 /* Line 1455 of yacc.c  */
-#line 12794 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12803 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(2) - (2)].lex_str);}
     break;
 
   case 1954:
 
 /* Line 1455 of yacc.c  */
-#line 12799 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12808 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.table)= new Table_ident((yyvsp[(1) - (1)].lex_str));
             if ((yyval.table) == NULL)
@@ -35253,7 +35262,7 @@ yyreduce:
   case 1955:
 
 /* Line 1455 of yacc.c  */
-#line 12805 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12814 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.table)= new Table_ident(thd, (yyvsp[(1) - (3)].lex_str),(yyvsp[(3) - (3)].lex_str),0);
             if ((yyval.table) == NULL)
@@ -35264,7 +35273,7 @@ yyreduce:
   case 1956:
 
 /* Line 1455 of yacc.c  */
-#line 12811 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12820 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /* For Delphi */
             (yyval.table)= new Table_ident((yyvsp[(2) - (2)].lex_str));
@@ -35276,7 +35285,7 @@ yyreduce:
   case 1957:
 
 /* Line 1455 of yacc.c  */
-#line 12821 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12830 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.table)= new Table_ident((yyvsp[(1) - (2)].lex_str));
             if ((yyval.table) == NULL)
@@ -35287,7 +35296,7 @@ yyreduce:
   case 1958:
 
 /* Line 1455 of yacc.c  */
-#line 12827 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12836 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.table)= new Table_ident(thd, (yyvsp[(1) - (4)].lex_str),(yyvsp[(3) - (4)].lex_str),0);
             if ((yyval.table) == NULL)
@@ -35298,7 +35307,7 @@ yyreduce:
   case 1959:
 
 /* Line 1455 of yacc.c  */
-#line 12836 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12845 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX_STRING db={(char*) any_db,3};
             (yyval.table)= new Table_ident(thd, db,(yyvsp[(1) - (1)].lex_str),0);
@@ -35310,14 +35319,14 @@ yyreduce:
   case 1960:
 
 /* Line 1455 of yacc.c  */
-#line 12845 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12854 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)= (yyvsp[(1) - (1)].lex_str); }
     break;
 
   case 1961:
 
 /* Line 1455 of yacc.c  */
-#line 12847 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12856 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (thd->charset_is_system_charset)
             {
@@ -35347,7 +35356,7 @@ yyreduce:
   case 1962:
 
 /* Line 1455 of yacc.c  */
-#line 12875 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12884 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (thd->charset_is_system_charset)
               (yyval.lex_str)= (yyvsp[(1) - (1)].lex_str);
@@ -35363,7 +35372,7 @@ yyreduce:
   case 1963:
 
 /* Line 1455 of yacc.c  */
-#line 12889 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12898 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (thd->charset_is_collation_connection)
               (yyval.lex_str)= (yyvsp[(1) - (1)].lex_str);
@@ -35379,7 +35388,7 @@ yyreduce:
   case 1964:
 
 /* Line 1455 of yacc.c  */
-#line 12903 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12912 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (thd->charset_is_character_set_filesystem)
               (yyval.lex_str)= (yyvsp[(1) - (1)].lex_str);
@@ -35396,14 +35405,14 @@ yyreduce:
   case 1965:
 
 /* Line 1455 of yacc.c  */
-#line 12917 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12926 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str); }
     break;
 
   case 1966:
 
 /* Line 1455 of yacc.c  */
-#line 12919 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12928 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_str).str= thd->strmake((yyvsp[(1) - (1)].symbol).str, (yyvsp[(1) - (1)].symbol).length);
             if ((yyval.lex_str).str == NULL)
@@ -35415,14 +35424,14 @@ yyreduce:
   case 1967:
 
 /* Line 1455 of yacc.c  */
-#line 12928 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12937 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str); }
     break;
 
   case 1968:
 
 /* Line 1455 of yacc.c  */
-#line 12930 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12939 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_str).str= thd->strmake((yyvsp[(1) - (1)].symbol).str, (yyvsp[(1) - (1)].symbol).length);
             if ((yyval.lex_str).str == NULL)
@@ -35434,28 +35443,28 @@ yyreduce:
   case 1969:
 
 /* Line 1455 of yacc.c  */
-#line 12939 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12948 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str);}
     break;
 
   case 1970:
 
 /* Line 1455 of yacc.c  */
-#line 12940 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12949 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str);}
     break;
 
   case 1971:
 
 /* Line 1455 of yacc.c  */
-#line 12941 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12950 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_str)=(yyvsp[(1) - (1)].lex_str);}
     break;
 
   case 1972:
 
 /* Line 1455 of yacc.c  */
-#line 12946 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12955 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!((yyval.lex_user)=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
               MYSQL_YYABORT;
@@ -35476,7 +35485,7 @@ yyreduce:
   case 1973:
 
 /* Line 1455 of yacc.c  */
-#line 12962 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12971 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!((yyval.lex_user)=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
               MYSQL_YYABORT;
@@ -35502,7 +35511,7 @@ yyreduce:
   case 1974:
 
 /* Line 1455 of yacc.c  */
-#line 12983 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 12992 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (!((yyval.lex_user)=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
               MYSQL_YYABORT;
@@ -35518,2471 +35527,2471 @@ yyreduce:
   case 1975:
 
 /* Line 1455 of yacc.c  */
-#line 12997 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13006 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1976:
 
 /* Line 1455 of yacc.c  */
-#line 12998 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13007 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1977:
 
 /* Line 1455 of yacc.c  */
-#line 12999 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13008 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1978:
 
 /* Line 1455 of yacc.c  */
-#line 13000 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13009 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1979:
 
 /* Line 1455 of yacc.c  */
-#line 13001 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13010 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1980:
 
 /* Line 1455 of yacc.c  */
-#line 13002 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13011 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1981:
 
 /* Line 1455 of yacc.c  */
-#line 13003 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13012 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1982:
 
 /* Line 1455 of yacc.c  */
-#line 13004 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13013 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1983:
 
 /* Line 1455 of yacc.c  */
-#line 13005 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13014 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1984:
 
 /* Line 1455 of yacc.c  */
-#line 13006 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13015 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1985:
 
 /* Line 1455 of yacc.c  */
-#line 13007 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13016 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1986:
 
 /* Line 1455 of yacc.c  */
-#line 13008 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13017 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1987:
 
 /* Line 1455 of yacc.c  */
-#line 13009 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13018 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1988:
 
 /* Line 1455 of yacc.c  */
-#line 13010 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13019 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1989:
 
 /* Line 1455 of yacc.c  */
-#line 13011 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13020 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1990:
 
 /* Line 1455 of yacc.c  */
-#line 13012 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13021 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1991:
 
 /* Line 1455 of yacc.c  */
-#line 13013 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13022 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1992:
 
 /* Line 1455 of yacc.c  */
-#line 13014 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13023 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1993:
 
 /* Line 1455 of yacc.c  */
-#line 13015 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13024 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1994:
 
 /* Line 1455 of yacc.c  */
-#line 13016 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13025 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1995:
 
 /* Line 1455 of yacc.c  */
-#line 13017 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13026 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1996:
 
 /* Line 1455 of yacc.c  */
-#line 13018 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13027 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1997:
 
 /* Line 1455 of yacc.c  */
-#line 13019 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13028 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1998:
 
 /* Line 1455 of yacc.c  */
-#line 13020 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13029 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 1999:
 
 /* Line 1455 of yacc.c  */
-#line 13021 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13030 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2000:
 
 /* Line 1455 of yacc.c  */
-#line 13022 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13031 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2001:
 
 /* Line 1455 of yacc.c  */
-#line 13023 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13032 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2002:
 
 /* Line 1455 of yacc.c  */
-#line 13024 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13033 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2003:
 
 /* Line 1455 of yacc.c  */
-#line 13025 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13034 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2004:
 
 /* Line 1455 of yacc.c  */
-#line 13026 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13035 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2005:
 
 /* Line 1455 of yacc.c  */
-#line 13027 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13036 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2006:
 
 /* Line 1455 of yacc.c  */
-#line 13028 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13037 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2007:
 
 /* Line 1455 of yacc.c  */
-#line 13029 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13038 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2008:
 
 /* Line 1455 of yacc.c  */
-#line 13030 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13039 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2009:
 
 /* Line 1455 of yacc.c  */
-#line 13031 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13040 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2010:
 
 /* Line 1455 of yacc.c  */
-#line 13032 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13041 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2011:
 
 /* Line 1455 of yacc.c  */
-#line 13033 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13042 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2012:
 
 /* Line 1455 of yacc.c  */
-#line 13034 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13043 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2013:
 
 /* Line 1455 of yacc.c  */
-#line 13035 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13044 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2014:
 
 /* Line 1455 of yacc.c  */
-#line 13036 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13045 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2015:
 
 /* Line 1455 of yacc.c  */
-#line 13037 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13046 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2016:
 
 /* Line 1455 of yacc.c  */
-#line 13038 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13047 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2017:
 
 /* Line 1455 of yacc.c  */
-#line 13039 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13048 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2018:
 
 /* Line 1455 of yacc.c  */
-#line 13040 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13049 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2019:
 
 /* Line 1455 of yacc.c  */
-#line 13041 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13050 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2020:
 
 /* Line 1455 of yacc.c  */
-#line 13042 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13051 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2021:
 
 /* Line 1455 of yacc.c  */
-#line 13043 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13052 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2022:
 
 /* Line 1455 of yacc.c  */
-#line 13044 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13053 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2023:
 
 /* Line 1455 of yacc.c  */
-#line 13045 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13054 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2024:
 
 /* Line 1455 of yacc.c  */
-#line 13046 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13055 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2025:
 
 /* Line 1455 of yacc.c  */
-#line 13047 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13056 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2026:
 
 /* Line 1455 of yacc.c  */
-#line 13048 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13057 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2027:
 
 /* Line 1455 of yacc.c  */
-#line 13049 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13058 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2028:
 
 /* Line 1455 of yacc.c  */
-#line 13050 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13059 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2029:
 
 /* Line 1455 of yacc.c  */
-#line 13051 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13060 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2030:
 
 /* Line 1455 of yacc.c  */
-#line 13052 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13061 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2031:
 
 /* Line 1455 of yacc.c  */
-#line 13053 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13062 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2032:
 
 /* Line 1455 of yacc.c  */
-#line 13054 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13063 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2033:
 
 /* Line 1455 of yacc.c  */
-#line 13055 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13064 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2034:
 
 /* Line 1455 of yacc.c  */
-#line 13065 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13074 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2035:
 
 /* Line 1455 of yacc.c  */
-#line 13066 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13075 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2036:
 
 /* Line 1455 of yacc.c  */
-#line 13067 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13076 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2037:
 
 /* Line 1455 of yacc.c  */
-#line 13068 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13077 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2038:
 
 /* Line 1455 of yacc.c  */
-#line 13069 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13078 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2039:
 
 /* Line 1455 of yacc.c  */
-#line 13070 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13079 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2040:
 
 /* Line 1455 of yacc.c  */
-#line 13071 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13080 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2041:
 
 /* Line 1455 of yacc.c  */
-#line 13072 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13081 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2042:
 
 /* Line 1455 of yacc.c  */
-#line 13073 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13082 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2043:
 
 /* Line 1455 of yacc.c  */
-#line 13074 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13083 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2044:
 
 /* Line 1455 of yacc.c  */
-#line 13075 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13084 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2045:
 
 /* Line 1455 of yacc.c  */
-#line 13076 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13085 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2046:
 
 /* Line 1455 of yacc.c  */
-#line 13077 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13086 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2047:
 
 /* Line 1455 of yacc.c  */
-#line 13078 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13087 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2048:
 
 /* Line 1455 of yacc.c  */
-#line 13079 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13088 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2049:
 
 /* Line 1455 of yacc.c  */
-#line 13080 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13089 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2050:
 
 /* Line 1455 of yacc.c  */
-#line 13081 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13090 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2051:
 
 /* Line 1455 of yacc.c  */
-#line 13082 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13091 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2052:
 
 /* Line 1455 of yacc.c  */
-#line 13083 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13092 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2053:
 
 /* Line 1455 of yacc.c  */
-#line 13084 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13093 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2054:
 
 /* Line 1455 of yacc.c  */
-#line 13085 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13094 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2055:
 
 /* Line 1455 of yacc.c  */
-#line 13086 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13095 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2056:
 
 /* Line 1455 of yacc.c  */
-#line 13087 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13096 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2057:
 
 /* Line 1455 of yacc.c  */
-#line 13088 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13097 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2058:
 
 /* Line 1455 of yacc.c  */
-#line 13089 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13098 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2059:
 
 /* Line 1455 of yacc.c  */
-#line 13090 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13099 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2060:
 
 /* Line 1455 of yacc.c  */
-#line 13091 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13100 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2061:
 
 /* Line 1455 of yacc.c  */
-#line 13092 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13101 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2062:
 
 /* Line 1455 of yacc.c  */
-#line 13093 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13102 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2063:
 
 /* Line 1455 of yacc.c  */
-#line 13094 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13103 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2064:
 
 /* Line 1455 of yacc.c  */
-#line 13095 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13104 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2065:
 
 /* Line 1455 of yacc.c  */
-#line 13096 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13105 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2066:
 
 /* Line 1455 of yacc.c  */
-#line 13097 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13106 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2067:
 
 /* Line 1455 of yacc.c  */
-#line 13098 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13107 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2068:
 
 /* Line 1455 of yacc.c  */
-#line 13099 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13108 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2069:
 
 /* Line 1455 of yacc.c  */
-#line 13100 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13109 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2070:
 
 /* Line 1455 of yacc.c  */
-#line 13101 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13110 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2071:
 
 /* Line 1455 of yacc.c  */
-#line 13102 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13111 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2072:
 
 /* Line 1455 of yacc.c  */
-#line 13103 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13112 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2073:
 
 /* Line 1455 of yacc.c  */
-#line 13104 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13113 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2074:
 
 /* Line 1455 of yacc.c  */
-#line 13105 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13114 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2075:
 
 /* Line 1455 of yacc.c  */
-#line 13106 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13115 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2076:
 
 /* Line 1455 of yacc.c  */
-#line 13107 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13116 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2077:
 
 /* Line 1455 of yacc.c  */
-#line 13108 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13117 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2078:
 
 /* Line 1455 of yacc.c  */
-#line 13109 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13118 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2079:
 
 /* Line 1455 of yacc.c  */
-#line 13110 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13119 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2080:
 
 /* Line 1455 of yacc.c  */
-#line 13111 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13120 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2081:
 
 /* Line 1455 of yacc.c  */
-#line 13112 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13121 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2082:
 
 /* Line 1455 of yacc.c  */
-#line 13113 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13122 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2083:
 
 /* Line 1455 of yacc.c  */
-#line 13114 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13123 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2084:
 
 /* Line 1455 of yacc.c  */
-#line 13115 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13124 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2085:
 
 /* Line 1455 of yacc.c  */
-#line 13116 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13125 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2086:
 
 /* Line 1455 of yacc.c  */
-#line 13117 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13126 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2087:
 
 /* Line 1455 of yacc.c  */
-#line 13118 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13127 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2088:
 
 /* Line 1455 of yacc.c  */
-#line 13119 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13128 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2089:
 
 /* Line 1455 of yacc.c  */
-#line 13120 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13129 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2090:
 
 /* Line 1455 of yacc.c  */
-#line 13121 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13130 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2091:
 
 /* Line 1455 of yacc.c  */
-#line 13122 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13131 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2092:
 
 /* Line 1455 of yacc.c  */
-#line 13123 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13132 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2093:
 
 /* Line 1455 of yacc.c  */
-#line 13124 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13133 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2094:
 
 /* Line 1455 of yacc.c  */
-#line 13125 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13134 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2095:
 
 /* Line 1455 of yacc.c  */
-#line 13126 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13135 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2096:
 
 /* Line 1455 of yacc.c  */
-#line 13127 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13136 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2097:
 
 /* Line 1455 of yacc.c  */
-#line 13128 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13137 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2098:
 
 /* Line 1455 of yacc.c  */
-#line 13129 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13138 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2099:
 
 /* Line 1455 of yacc.c  */
-#line 13130 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13139 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2100:
 
 /* Line 1455 of yacc.c  */
-#line 13131 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13140 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2101:
 
 /* Line 1455 of yacc.c  */
-#line 13132 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13141 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2102:
 
 /* Line 1455 of yacc.c  */
-#line 13133 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13142 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2103:
 
 /* Line 1455 of yacc.c  */
-#line 13134 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13143 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2104:
 
 /* Line 1455 of yacc.c  */
-#line 13135 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13144 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2105:
 
 /* Line 1455 of yacc.c  */
-#line 13136 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13145 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2106:
 
 /* Line 1455 of yacc.c  */
-#line 13137 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13146 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2107:
 
 /* Line 1455 of yacc.c  */
-#line 13138 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13147 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2108:
 
 /* Line 1455 of yacc.c  */
-#line 13139 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13148 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2109:
 
 /* Line 1455 of yacc.c  */
-#line 13140 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13149 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2110:
 
 /* Line 1455 of yacc.c  */
-#line 13141 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13150 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2111:
 
 /* Line 1455 of yacc.c  */
-#line 13142 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13151 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2112:
 
 /* Line 1455 of yacc.c  */
-#line 13143 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13152 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2113:
 
 /* Line 1455 of yacc.c  */
-#line 13144 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13153 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2114:
 
 /* Line 1455 of yacc.c  */
-#line 13145 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13154 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2115:
 
 /* Line 1455 of yacc.c  */
-#line 13146 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13155 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2116:
 
 /* Line 1455 of yacc.c  */
-#line 13147 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13156 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2117:
 
 /* Line 1455 of yacc.c  */
-#line 13148 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13157 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2118:
 
 /* Line 1455 of yacc.c  */
-#line 13149 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13158 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2119:
 
 /* Line 1455 of yacc.c  */
-#line 13150 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13159 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2120:
 
 /* Line 1455 of yacc.c  */
-#line 13151 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13160 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2121:
 
 /* Line 1455 of yacc.c  */
-#line 13152 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13161 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2122:
 
 /* Line 1455 of yacc.c  */
-#line 13153 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13162 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2123:
 
 /* Line 1455 of yacc.c  */
-#line 13154 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13163 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2124:
 
 /* Line 1455 of yacc.c  */
-#line 13155 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13164 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2125:
 
 /* Line 1455 of yacc.c  */
-#line 13156 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13165 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2126:
 
 /* Line 1455 of yacc.c  */
-#line 13157 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13166 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2127:
 
 /* Line 1455 of yacc.c  */
-#line 13158 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13167 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2128:
 
 /* Line 1455 of yacc.c  */
-#line 13159 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13168 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2129:
 
 /* Line 1455 of yacc.c  */
-#line 13160 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13169 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2130:
 
 /* Line 1455 of yacc.c  */
-#line 13161 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13170 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2131:
 
 /* Line 1455 of yacc.c  */
-#line 13162 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13171 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2132:
 
 /* Line 1455 of yacc.c  */
-#line 13163 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13172 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2133:
 
 /* Line 1455 of yacc.c  */
-#line 13164 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13173 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2134:
 
 /* Line 1455 of yacc.c  */
-#line 13165 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13174 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2135:
 
 /* Line 1455 of yacc.c  */
-#line 13166 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13175 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2136:
 
 /* Line 1455 of yacc.c  */
-#line 13167 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13176 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2137:
 
 /* Line 1455 of yacc.c  */
-#line 13168 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13177 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2138:
 
 /* Line 1455 of yacc.c  */
-#line 13169 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13178 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2139:
 
 /* Line 1455 of yacc.c  */
-#line 13170 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13179 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2140:
 
 /* Line 1455 of yacc.c  */
-#line 13171 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13180 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2141:
 
 /* Line 1455 of yacc.c  */
-#line 13172 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13181 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2142:
 
 /* Line 1455 of yacc.c  */
-#line 13173 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13182 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2143:
 
 /* Line 1455 of yacc.c  */
-#line 13174 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13183 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2144:
 
 /* Line 1455 of yacc.c  */
-#line 13175 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13184 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2145:
 
 /* Line 1455 of yacc.c  */
-#line 13176 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13185 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2146:
 
 /* Line 1455 of yacc.c  */
-#line 13177 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13186 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2147:
 
 /* Line 1455 of yacc.c  */
-#line 13178 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13187 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2148:
 
 /* Line 1455 of yacc.c  */
-#line 13179 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13188 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2149:
 
 /* Line 1455 of yacc.c  */
-#line 13180 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13189 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2150:
 
 /* Line 1455 of yacc.c  */
-#line 13181 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13190 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2151:
 
 /* Line 1455 of yacc.c  */
-#line 13182 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13191 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2152:
 
 /* Line 1455 of yacc.c  */
-#line 13183 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13192 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2153:
 
 /* Line 1455 of yacc.c  */
-#line 13184 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13193 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2154:
 
 /* Line 1455 of yacc.c  */
-#line 13185 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13194 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2155:
 
 /* Line 1455 of yacc.c  */
-#line 13186 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13195 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2156:
 
 /* Line 1455 of yacc.c  */
-#line 13187 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13196 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2157:
 
 /* Line 1455 of yacc.c  */
-#line 13188 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13197 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2158:
 
 /* Line 1455 of yacc.c  */
-#line 13189 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13198 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2159:
 
 /* Line 1455 of yacc.c  */
-#line 13190 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13199 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2160:
 
 /* Line 1455 of yacc.c  */
-#line 13191 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13200 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2161:
 
 /* Line 1455 of yacc.c  */
-#line 13192 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13201 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2162:
 
 /* Line 1455 of yacc.c  */
-#line 13193 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13202 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2163:
 
 /* Line 1455 of yacc.c  */
-#line 13194 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13203 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2164:
 
 /* Line 1455 of yacc.c  */
-#line 13195 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13204 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2165:
 
 /* Line 1455 of yacc.c  */
-#line 13196 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13205 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2166:
 
 /* Line 1455 of yacc.c  */
-#line 13197 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13206 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2167:
 
 /* Line 1455 of yacc.c  */
-#line 13198 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13207 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2168:
 
 /* Line 1455 of yacc.c  */
-#line 13199 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13208 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2169:
 
 /* Line 1455 of yacc.c  */
-#line 13200 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13209 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2170:
 
 /* Line 1455 of yacc.c  */
-#line 13201 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13210 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2171:
 
 /* Line 1455 of yacc.c  */
-#line 13202 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13211 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2172:
 
 /* Line 1455 of yacc.c  */
-#line 13203 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13212 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2173:
 
 /* Line 1455 of yacc.c  */
-#line 13204 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13213 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2174:
 
 /* Line 1455 of yacc.c  */
-#line 13205 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13214 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2175:
 
 /* Line 1455 of yacc.c  */
-#line 13206 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13215 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2176:
 
 /* Line 1455 of yacc.c  */
-#line 13207 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13216 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2177:
 
 /* Line 1455 of yacc.c  */
-#line 13208 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13217 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2178:
 
 /* Line 1455 of yacc.c  */
-#line 13209 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13218 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2179:
 
 /* Line 1455 of yacc.c  */
-#line 13210 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13219 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2180:
 
 /* Line 1455 of yacc.c  */
-#line 13211 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13220 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2181:
 
 /* Line 1455 of yacc.c  */
-#line 13212 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13221 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2182:
 
 /* Line 1455 of yacc.c  */
-#line 13213 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13222 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2183:
 
 /* Line 1455 of yacc.c  */
-#line 13214 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13223 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2184:
 
 /* Line 1455 of yacc.c  */
-#line 13215 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13224 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2185:
 
 /* Line 1455 of yacc.c  */
-#line 13216 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13225 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2186:
 
 /* Line 1455 of yacc.c  */
-#line 13217 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13226 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2187:
 
 /* Line 1455 of yacc.c  */
-#line 13218 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13227 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2188:
 
 /* Line 1455 of yacc.c  */
-#line 13219 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13228 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2189:
 
 /* Line 1455 of yacc.c  */
-#line 13220 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13229 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2190:
 
 /* Line 1455 of yacc.c  */
-#line 13221 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13230 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2191:
 
 /* Line 1455 of yacc.c  */
-#line 13222 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13231 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2192:
 
 /* Line 1455 of yacc.c  */
-#line 13223 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13232 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2193:
 
 /* Line 1455 of yacc.c  */
-#line 13224 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13233 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2194:
 
 /* Line 1455 of yacc.c  */
-#line 13225 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13234 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2195:
 
 /* Line 1455 of yacc.c  */
-#line 13226 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13235 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2196:
 
 /* Line 1455 of yacc.c  */
-#line 13227 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13236 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2197:
 
 /* Line 1455 of yacc.c  */
-#line 13228 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13237 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2198:
 
 /* Line 1455 of yacc.c  */
-#line 13229 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13238 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2199:
 
 /* Line 1455 of yacc.c  */
-#line 13230 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13239 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2200:
 
 /* Line 1455 of yacc.c  */
-#line 13231 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13240 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2201:
 
 /* Line 1455 of yacc.c  */
-#line 13232 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13241 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2202:
 
 /* Line 1455 of yacc.c  */
-#line 13233 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13242 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2203:
 
 /* Line 1455 of yacc.c  */
-#line 13234 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13243 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2204:
 
 /* Line 1455 of yacc.c  */
-#line 13235 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13244 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2205:
 
 /* Line 1455 of yacc.c  */
-#line 13236 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13245 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2206:
 
 /* Line 1455 of yacc.c  */
-#line 13237 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13246 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2207:
 
 /* Line 1455 of yacc.c  */
-#line 13238 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13247 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2208:
 
 /* Line 1455 of yacc.c  */
-#line 13239 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13248 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2209:
 
 /* Line 1455 of yacc.c  */
-#line 13240 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13249 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2210:
 
 /* Line 1455 of yacc.c  */
-#line 13241 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13250 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2211:
 
 /* Line 1455 of yacc.c  */
-#line 13242 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13251 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2212:
 
 /* Line 1455 of yacc.c  */
-#line 13243 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13252 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2213:
 
 /* Line 1455 of yacc.c  */
-#line 13244 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13253 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2214:
 
 /* Line 1455 of yacc.c  */
-#line 13245 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13254 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2215:
 
 /* Line 1455 of yacc.c  */
-#line 13246 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13255 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2216:
 
 /* Line 1455 of yacc.c  */
-#line 13247 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13256 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2217:
 
 /* Line 1455 of yacc.c  */
-#line 13248 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13257 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2218:
 
 /* Line 1455 of yacc.c  */
-#line 13249 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13258 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2219:
 
 /* Line 1455 of yacc.c  */
-#line 13250 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13259 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2220:
 
 /* Line 1455 of yacc.c  */
-#line 13251 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13260 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2221:
 
 /* Line 1455 of yacc.c  */
-#line 13252 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13261 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2222:
 
 /* Line 1455 of yacc.c  */
-#line 13253 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13262 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2223:
 
 /* Line 1455 of yacc.c  */
-#line 13254 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13263 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2224:
 
 /* Line 1455 of yacc.c  */
-#line 13255 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13264 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2225:
 
 /* Line 1455 of yacc.c  */
-#line 13256 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13265 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2226:
 
 /* Line 1455 of yacc.c  */
-#line 13257 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13266 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2227:
 
 /* Line 1455 of yacc.c  */
-#line 13258 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13267 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2228:
 
 /* Line 1455 of yacc.c  */
-#line 13259 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13268 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2229:
 
 /* Line 1455 of yacc.c  */
-#line 13260 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13269 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2230:
 
 /* Line 1455 of yacc.c  */
-#line 13261 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13270 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2231:
 
 /* Line 1455 of yacc.c  */
-#line 13262 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13271 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2232:
 
 /* Line 1455 of yacc.c  */
-#line 13263 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13272 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2233:
 
 /* Line 1455 of yacc.c  */
-#line 13264 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13273 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2234:
 
 /* Line 1455 of yacc.c  */
-#line 13265 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13274 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2235:
 
 /* Line 1455 of yacc.c  */
-#line 13266 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13275 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2236:
 
 /* Line 1455 of yacc.c  */
-#line 13267 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13276 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2237:
 
 /* Line 1455 of yacc.c  */
-#line 13268 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13277 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2238:
 
 /* Line 1455 of yacc.c  */
-#line 13269 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13278 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2239:
 
 /* Line 1455 of yacc.c  */
-#line 13270 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13279 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2240:
 
 /* Line 1455 of yacc.c  */
-#line 13271 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13280 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2241:
 
 /* Line 1455 of yacc.c  */
-#line 13272 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13281 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2242:
 
 /* Line 1455 of yacc.c  */
-#line 13273 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13282 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2243:
 
 /* Line 1455 of yacc.c  */
-#line 13274 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13283 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2244:
 
 /* Line 1455 of yacc.c  */
-#line 13275 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13284 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2245:
 
 /* Line 1455 of yacc.c  */
-#line 13276 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13285 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2246:
 
 /* Line 1455 of yacc.c  */
-#line 13277 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13286 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2247:
 
 /* Line 1455 of yacc.c  */
-#line 13278 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13287 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2248:
 
 /* Line 1455 of yacc.c  */
-#line 13279 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13288 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2249:
 
 /* Line 1455 of yacc.c  */
-#line 13280 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13289 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2250:
 
 /* Line 1455 of yacc.c  */
-#line 13281 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13290 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2251:
 
 /* Line 1455 of yacc.c  */
-#line 13282 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13291 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2252:
 
 /* Line 1455 of yacc.c  */
-#line 13283 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13292 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2253:
 
 /* Line 1455 of yacc.c  */
-#line 13284 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13293 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2254:
 
 /* Line 1455 of yacc.c  */
-#line 13285 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13294 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2255:
 
 /* Line 1455 of yacc.c  */
-#line 13286 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13295 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2256:
 
 /* Line 1455 of yacc.c  */
-#line 13287 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13296 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2257:
 
 /* Line 1455 of yacc.c  */
-#line 13288 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13297 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2258:
 
 /* Line 1455 of yacc.c  */
-#line 13289 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13298 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2259:
 
 /* Line 1455 of yacc.c  */
-#line 13290 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13299 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2260:
 
 /* Line 1455 of yacc.c  */
-#line 13291 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13300 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2261:
 
 /* Line 1455 of yacc.c  */
-#line 13292 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13301 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2262:
 
 /* Line 1455 of yacc.c  */
-#line 13293 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13302 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2263:
 
 /* Line 1455 of yacc.c  */
-#line 13294 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13303 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2264:
 
 /* Line 1455 of yacc.c  */
-#line 13295 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13304 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2265:
 
 /* Line 1455 of yacc.c  */
-#line 13296 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13305 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2266:
 
 /* Line 1455 of yacc.c  */
-#line 13297 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13306 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2267:
 
 /* Line 1455 of yacc.c  */
-#line 13298 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13307 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2268:
 
 /* Line 1455 of yacc.c  */
-#line 13299 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13308 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2269:
 
 /* Line 1455 of yacc.c  */
-#line 13300 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13309 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2270:
 
 /* Line 1455 of yacc.c  */
-#line 13301 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13310 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2271:
 
 /* Line 1455 of yacc.c  */
-#line 13302 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13311 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2272:
 
 /* Line 1455 of yacc.c  */
-#line 13303 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13312 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2273:
 
 /* Line 1455 of yacc.c  */
-#line 13304 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13313 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2274:
 
 /* Line 1455 of yacc.c  */
-#line 13305 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13314 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2275:
 
 /* Line 1455 of yacc.c  */
-#line 13306 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13315 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2276:
 
 /* Line 1455 of yacc.c  */
-#line 13307 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13316 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2277:
 
 /* Line 1455 of yacc.c  */
-#line 13308 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13317 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2278:
 
 /* Line 1455 of yacc.c  */
-#line 13309 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13318 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2279:
 
 /* Line 1455 of yacc.c  */
-#line 13310 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13319 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2280:
 
 /* Line 1455 of yacc.c  */
-#line 13311 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13320 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2281:
 
 /* Line 1455 of yacc.c  */
-#line 13312 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13321 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2282:
 
 /* Line 1455 of yacc.c  */
-#line 13313 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13322 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2283:
 
 /* Line 1455 of yacc.c  */
-#line 13314 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13323 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2284:
 
 /* Line 1455 of yacc.c  */
-#line 13315 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13324 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2285:
 
 /* Line 1455 of yacc.c  */
-#line 13316 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13325 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2286:
 
 /* Line 1455 of yacc.c  */
-#line 13317 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13326 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2287:
 
 /* Line 1455 of yacc.c  */
-#line 13318 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13327 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2288:
 
 /* Line 1455 of yacc.c  */
-#line 13319 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13328 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2289:
 
 /* Line 1455 of yacc.c  */
-#line 13320 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13329 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2290:
 
 /* Line 1455 of yacc.c  */
-#line 13321 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13330 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2291:
 
 /* Line 1455 of yacc.c  */
-#line 13322 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13331 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2292:
 
 /* Line 1455 of yacc.c  */
-#line 13323 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13332 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2293:
 
 /* Line 1455 of yacc.c  */
-#line 13324 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13333 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2294:
 
 /* Line 1455 of yacc.c  */
-#line 13325 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13334 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2295:
 
 /* Line 1455 of yacc.c  */
-#line 13326 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13335 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2296:
 
 /* Line 1455 of yacc.c  */
-#line 13327 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13336 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2297:
 
 /* Line 1455 of yacc.c  */
-#line 13328 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13337 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2298:
 
 /* Line 1455 of yacc.c  */
-#line 13329 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13338 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2299:
 
 /* Line 1455 of yacc.c  */
-#line 13330 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13339 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2300:
 
 /* Line 1455 of yacc.c  */
-#line 13331 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13340 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2301:
 
 /* Line 1455 of yacc.c  */
-#line 13332 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13341 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2302:
 
 /* Line 1455 of yacc.c  */
-#line 13333 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13342 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2303:
 
 /* Line 1455 of yacc.c  */
-#line 13334 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13343 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2304:
 
 /* Line 1455 of yacc.c  */
-#line 13335 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13344 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2305:
 
 /* Line 1455 of yacc.c  */
-#line 13336 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13345 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2306:
 
 /* Line 1455 of yacc.c  */
-#line 13337 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13346 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2307:
 
 /* Line 1455 of yacc.c  */
-#line 13338 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13347 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2308:
 
 /* Line 1455 of yacc.c  */
-#line 13339 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13348 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2309:
 
 /* Line 1455 of yacc.c  */
-#line 13340 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13349 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2310:
 
 /* Line 1455 of yacc.c  */
-#line 13341 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13350 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2311:
 
 /* Line 1455 of yacc.c  */
-#line 13342 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13351 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2312:
 
 /* Line 1455 of yacc.c  */
-#line 13343 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13352 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2313:
 
 /* Line 1455 of yacc.c  */
-#line 13344 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13353 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2314:
 
 /* Line 1455 of yacc.c  */
-#line 13345 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13354 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2315:
 
 /* Line 1455 of yacc.c  */
-#line 13346 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13355 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2316:
 
 /* Line 1455 of yacc.c  */
-#line 13347 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13356 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2317:
 
 /* Line 1455 of yacc.c  */
-#line 13348 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13357 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2318:
 
 /* Line 1455 of yacc.c  */
-#line 13349 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13358 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2319:
 
 /* Line 1455 of yacc.c  */
-#line 13350 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13359 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2320:
 
 /* Line 1455 of yacc.c  */
-#line 13351 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13360 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2321:
 
 /* Line 1455 of yacc.c  */
-#line 13352 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13361 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2322:
 
 /* Line 1455 of yacc.c  */
-#line 13353 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13362 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2323:
 
 /* Line 1455 of yacc.c  */
-#line 13354 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13363 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2324:
 
 /* Line 1455 of yacc.c  */
-#line 13355 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13364 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2325:
 
 /* Line 1455 of yacc.c  */
-#line 13356 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13365 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2326:
 
 /* Line 1455 of yacc.c  */
-#line 13357 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13366 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2327:
 
 /* Line 1455 of yacc.c  */
-#line 13364 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13373 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SET_OPTION;
@@ -37997,28 +38006,28 @@ yyreduce:
   case 2328:
 
 /* Line 1455 of yacc.c  */
-#line 13374 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13383 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2329:
 
 /* Line 1455 of yacc.c  */
-#line 13378 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13387 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2330:
 
 /* Line 1455 of yacc.c  */
-#line 13379 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13388 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2333:
 
 /* Line 1455 of yacc.c  */
-#line 13388 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13397 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -38053,7 +38062,7 @@ yyreduce:
   case 2334:
 
 /* Line 1455 of yacc.c  */
-#line 13418 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13427 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -38106,105 +38115,105 @@ yyreduce:
   case 2335:
 
 /* Line 1455 of yacc.c  */
-#line 13468 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13477 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2336:
 
 /* Line 1455 of yacc.c  */
-#line 13469 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13478 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_GLOBAL; }
     break;
 
   case 2337:
 
 /* Line 1455 of yacc.c  */
-#line 13470 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13479 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2338:
 
 /* Line 1455 of yacc.c  */
-#line 13471 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13480 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2339:
 
 /* Line 1455 of yacc.c  */
-#line 13475 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13484 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= OPT_DEFAULT; }
     break;
 
   case 2340:
 
 /* Line 1455 of yacc.c  */
-#line 13476 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13485 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->one_shot_set= 1; (yyval.num)= OPT_SESSION; }
     break;
 
   case 2341:
 
 /* Line 1455 of yacc.c  */
-#line 13480 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13489 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2342:
 
 /* Line 1455 of yacc.c  */
-#line 13481 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13490 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_GLOBAL; }
     break;
 
   case 2343:
 
 /* Line 1455 of yacc.c  */
-#line 13482 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13491 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2344:
 
 /* Line 1455 of yacc.c  */
-#line 13483 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13492 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2345:
 
 /* Line 1455 of yacc.c  */
-#line 13487 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13496 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_DEFAULT; }
     break;
 
   case 2346:
 
 /* Line 1455 of yacc.c  */
-#line 13488 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13497 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_GLOBAL; }
     break;
 
   case 2347:
 
 /* Line 1455 of yacc.c  */
-#line 13489 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13498 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2348:
 
 /* Line 1455 of yacc.c  */
-#line 13490 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13499 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.var_type)=OPT_SESSION; }
     break;
 
   case 2351:
 
 /* Line 1455 of yacc.c  */
-#line 13500 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13509 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             LEX_STRING *name= &(yyvsp[(2) - (4)].variable).base_name;
@@ -38250,7 +38259,7 @@ yyreduce:
   case 2352:
 
 /* Line 1455 of yacc.c  */
-#line 13541 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13550 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->option_type= (yyvsp[(1) - (5)].var_type);
@@ -38270,7 +38279,7 @@ yyreduce:
   case 2353:
 
 /* Line 1455 of yacc.c  */
-#line 13559 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13568 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Item_func_set_user_var *item;
             item= new (thd->mem_root) Item_func_set_user_var((yyvsp[(2) - (4)].lex_str), (yyvsp[(4) - (4)].item));
@@ -38286,7 +38295,7 @@ yyreduce:
   case 2354:
 
 /* Line 1455 of yacc.c  */
-#line 13570 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13579 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             struct sys_var_with_base tmp= (yyvsp[(4) - (6)].variable);
             /* Lookup if necessary: must be a system variable. */
@@ -38303,7 +38312,7 @@ yyreduce:
   case 2355:
 
 /* Line 1455 of yacc.c  */
-#line 13582 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13591 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             CHARSET_INFO *cs2;
@@ -38321,7 +38330,7 @@ yyreduce:
   case 2356:
 
 /* Line 1455 of yacc.c  */
-#line 13595 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13604 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             sp_pcontext *spc= lex->spcont;
@@ -38341,7 +38350,7 @@ yyreduce:
   case 2357:
 
 /* Line 1455 of yacc.c  */
-#line 13610 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13619 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             CHARSET_INFO *cs2;
@@ -38365,7 +38374,7 @@ yyreduce:
   case 2358:
 
 /* Line 1455 of yacc.c  */
-#line 13629 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13638 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             LEX_USER *user;
@@ -38396,7 +38405,7 @@ yyreduce:
   case 2359:
 
 /* Line 1455 of yacc.c  */
-#line 13655 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13664 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             set_var_password *var= new set_var_password((yyvsp[(3) - (5)].lex_user),(yyvsp[(5) - (5)].simple_string));
             if (var == NULL)
@@ -38411,7 +38420,7 @@ yyreduce:
   case 2360:
 
 /* Line 1455 of yacc.c  */
-#line 13668 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13677 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             sp_pcontext *spc= thd->lex->spcont;
             sp_variable_t *spv;
@@ -38442,7 +38451,7 @@ yyreduce:
   case 2361:
 
 /* Line 1455 of yacc.c  */
-#line 13694 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13703 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (check_reserved_words(&(yyvsp[(1) - (3)].lex_str)))
@@ -38490,7 +38499,7 @@ yyreduce:
   case 2362:
 
 /* Line 1455 of yacc.c  */
-#line 13737 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13746 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             sys_var *tmp=find_sys_var(thd, (yyvsp[(3) - (3)].lex_str).str, (yyvsp[(3) - (3)].lex_str).length);
             if (!tmp)
@@ -38506,42 +38515,42 @@ yyreduce:
   case 2363:
 
 /* Line 1455 of yacc.c  */
-#line 13750 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13759 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.tx_isolation)= ISO_READ_UNCOMMITTED; }
     break;
 
   case 2364:
 
 /* Line 1455 of yacc.c  */
-#line 13751 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13760 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.tx_isolation)= ISO_READ_COMMITTED; }
     break;
 
   case 2365:
 
 /* Line 1455 of yacc.c  */
-#line 13752 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13761 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.tx_isolation)= ISO_REPEATABLE_READ; }
     break;
 
   case 2366:
 
 /* Line 1455 of yacc.c  */
-#line 13753 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13762 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.tx_isolation)= ISO_SERIALIZABLE; }
     break;
 
   case 2367:
 
 /* Line 1455 of yacc.c  */
-#line 13757 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13766 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.simple_string)=(yyvsp[(1) - (1)].lex_str).str;}
     break;
 
   case 2368:
 
 /* Line 1455 of yacc.c  */
-#line 13759 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13768 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.simple_string)= (yyvsp[(3) - (4)].lex_str).length ? thd->variables.old_passwords ?
               Item_func_old_password::alloc(thd, (yyvsp[(3) - (4)].lex_str).str, (yyvsp[(3) - (4)].lex_str).length) :
@@ -38555,7 +38564,7 @@ yyreduce:
   case 2369:
 
 /* Line 1455 of yacc.c  */
-#line 13768 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13777 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.simple_string)= (yyvsp[(3) - (4)].lex_str).length ? Item_func_old_password::alloc(thd, (yyvsp[(3) - (4)].lex_str).str,
                                                           (yyvsp[(3) - (4)].lex_str).length) :
@@ -38568,21 +38577,21 @@ yyreduce:
   case 2370:
 
 /* Line 1455 of yacc.c  */
-#line 13779 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13788 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)=(yyvsp[(1) - (1)].item); }
     break;
 
   case 2371:
 
 /* Line 1455 of yacc.c  */
-#line 13780 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13789 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.item)=0; }
     break;
 
   case 2372:
 
 /* Line 1455 of yacc.c  */
-#line 13782 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13791 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)=new (thd->mem_root) Item_string("ON",  2, system_charset_info);
             if ((yyval.item) == NULL)
@@ -38593,7 +38602,7 @@ yyreduce:
   case 2373:
 
 /* Line 1455 of yacc.c  */
-#line 13788 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13797 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)=new (thd->mem_root) Item_string("ALL", 3, system_charset_info);
             if ((yyval.item) == NULL)
@@ -38604,7 +38613,7 @@ yyreduce:
   case 2374:
 
 /* Line 1455 of yacc.c  */
-#line 13794 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13803 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.item)=new (thd->mem_root) Item_string("binary", 6, system_charset_info);
             if ((yyval.item) == NULL)
@@ -38615,7 +38624,7 @@ yyreduce:
   case 2375:
 
 /* Line 1455 of yacc.c  */
-#line 13805 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13814 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
 
@@ -38631,28 +38640,28 @@ yyreduce:
   case 2376:
 
 /* Line 1455 of yacc.c  */
-#line 13816 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13825 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2377:
 
 /* Line 1455 of yacc.c  */
-#line 13820 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13829 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 2378:
 
 /* Line 1455 of yacc.c  */
-#line 13821 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13830 "/home/buildbot/git/sql/sql_yacc.yy"
     { }
     break;
 
   case 2381:
 
 /* Line 1455 of yacc.c  */
-#line 13831 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13840 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             thr_lock_type lock_type= (thr_lock_type) (yyvsp[(3) - (3)].num);
             bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE);
@@ -38669,21 +38678,21 @@ yyreduce:
   case 2382:
 
 /* Line 1455 of yacc.c  */
-#line 13845 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13854 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= TL_READ_NO_INSERT; }
     break;
 
   case 2383:
 
 /* Line 1455 of yacc.c  */
-#line 13846 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13855 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= TL_WRITE_DEFAULT; }
     break;
 
   case 2384:
 
 /* Line 1455 of yacc.c  */
-#line 13848 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13857 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.num)= (Lex->sphead ? TL_WRITE_DEFAULT : TL_WRITE_CONCURRENT_INSERT);
           }
@@ -38692,21 +38701,21 @@ yyreduce:
   case 2385:
 
 /* Line 1455 of yacc.c  */
-#line 13852 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13861 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= TL_WRITE_LOW_PRIORITY; }
     break;
 
   case 2386:
 
 /* Line 1455 of yacc.c  */
-#line 13853 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13862 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= TL_READ; }
     break;
 
   case 2387:
 
 /* Line 1455 of yacc.c  */
-#line 13858 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13867 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
 
@@ -38722,14 +38731,14 @@ yyreduce:
   case 2388:
 
 /* Line 1455 of yacc.c  */
-#line 13869 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13878 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2389:
 
 /* Line 1455 of yacc.c  */
-#line 13878 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13887 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->sphead)
@@ -38746,7 +38755,7 @@ yyreduce:
   case 2390:
 
 /* Line 1455 of yacc.c  */
-#line 13890 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13899 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->sphead)
@@ -38763,7 +38772,7 @@ yyreduce:
   case 2391:
 
 /* Line 1455 of yacc.c  */
-#line 13902 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13911 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->sphead)
@@ -38788,7 +38797,7 @@ yyreduce:
   case 2392:
 
 /* Line 1455 of yacc.c  */
-#line 13922 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13931 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->expr_allows_subselect= TRUE;
             /* Stored functions are not supported for HANDLER READ. */
@@ -38804,63 +38813,63 @@ yyreduce:
   case 2393:
 
 /* Line 1455 of yacc.c  */
-#line 13935 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13944 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ident= null_lex_str; }
     break;
 
   case 2394:
 
 /* Line 1455 of yacc.c  */
-#line 13936 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13945 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ident= (yyvsp[(1) - (2)].lex_str); }
     break;
 
   case 2395:
 
 /* Line 1455 of yacc.c  */
-#line 13940 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13949 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RFIRST; }
     break;
 
   case 2396:
 
 /* Line 1455 of yacc.c  */
-#line 13941 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13950 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RNEXT;  }
     break;
 
   case 2397:
 
 /* Line 1455 of yacc.c  */
-#line 13945 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13954 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RFIRST; }
     break;
 
   case 2398:
 
 /* Line 1455 of yacc.c  */
-#line 13946 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13955 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RNEXT;  }
     break;
 
   case 2399:
 
 /* Line 1455 of yacc.c  */
-#line 13947 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13956 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RPREV;  }
     break;
 
   case 2400:
 
 /* Line 1455 of yacc.c  */
-#line 13948 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13957 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->ha_read_mode = RLAST;  }
     break;
 
   case 2401:
 
 /* Line 1455 of yacc.c  */
-#line 13950 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13959 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->ha_read_mode = RKEY;
@@ -38873,56 +38882,56 @@ yyreduce:
   case 2402:
 
 /* Line 1455 of yacc.c  */
-#line 13958 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13967 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2403:
 
 /* Line 1455 of yacc.c  */
-#line 13962 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13971 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ha_rkey_mode)=HA_READ_KEY_EXACT;   }
     break;
 
   case 2404:
 
 /* Line 1455 of yacc.c  */
-#line 13963 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13972 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ha_rkey_mode)=HA_READ_KEY_OR_NEXT; }
     break;
 
   case 2405:
 
 /* Line 1455 of yacc.c  */
-#line 13964 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13973 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ha_rkey_mode)=HA_READ_KEY_OR_PREV; }
     break;
 
   case 2406:
 
 /* Line 1455 of yacc.c  */
-#line 13965 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13974 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ha_rkey_mode)=HA_READ_AFTER_KEY;   }
     break;
 
   case 2407:
 
 /* Line 1455 of yacc.c  */
-#line 13966 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13975 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.ha_rkey_mode)=HA_READ_BEFORE_KEY;  }
     break;
 
   case 2408:
 
 /* Line 1455 of yacc.c  */
-#line 13973 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13982 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2409:
 
 /* Line 1455 of yacc.c  */
-#line 13978 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13987 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_REVOKE;
@@ -38933,7 +38942,7 @@ yyreduce:
   case 2410:
 
 /* Line 1455 of yacc.c  */
-#line 13984 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 13993 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->columns.elements)
@@ -38949,7 +38958,7 @@ yyreduce:
   case 2411:
 
 /* Line 1455 of yacc.c  */
-#line 13995 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14004 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->columns.elements)
@@ -38965,7 +38974,7 @@ yyreduce:
   case 2412:
 
 /* Line 1455 of yacc.c  */
-#line 14006 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14015 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_REVOKE_ALL;
           }
@@ -38974,7 +38983,7 @@ yyreduce:
   case 2413:
 
 /* Line 1455 of yacc.c  */
-#line 14010 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14019 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->users_list.push_front ((yyvsp[(3) - (5)].lex_user));
@@ -38986,14 +38995,14 @@ yyreduce:
   case 2414:
 
 /* Line 1455 of yacc.c  */
-#line 14020 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14029 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2415:
 
 /* Line 1455 of yacc.c  */
-#line 14026 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14035 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_GRANT;
@@ -39004,7 +39013,7 @@ yyreduce:
   case 2416:
 
 /* Line 1455 of yacc.c  */
-#line 14033 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14042 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->columns.elements)
@@ -39020,7 +39029,7 @@ yyreduce:
   case 2417:
 
 /* Line 1455 of yacc.c  */
-#line 14045 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14054 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             if (lex->columns.elements)
@@ -39036,7 +39045,7 @@ yyreduce:
   case 2418:
 
 /* Line 1455 of yacc.c  */
-#line 14056 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14065 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->users_list.push_front ((yyvsp[(3) - (6)].lex_user));
@@ -39048,14 +39057,14 @@ yyreduce:
   case 2421:
 
 /* Line 1455 of yacc.c  */
-#line 14070 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14079 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2422:
 
 /* Line 1455 of yacc.c  */
-#line 14072 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14081 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             Lex->all_privileges= 1; 
             Lex->grant= GLOBAL_ACLS;
@@ -39065,259 +39074,259 @@ yyreduce:
   case 2427:
 
 /* Line 1455 of yacc.c  */
-#line 14090 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14099 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->which_columns = SELECT_ACL;}
     break;
 
   case 2428:
 
 /* Line 1455 of yacc.c  */
-#line 14091 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14100 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2429:
 
 /* Line 1455 of yacc.c  */
-#line 14093 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14102 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->which_columns = INSERT_ACL;}
     break;
 
   case 2430:
 
 /* Line 1455 of yacc.c  */
-#line 14094 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14103 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2431:
 
 /* Line 1455 of yacc.c  */
-#line 14096 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14105 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->which_columns = UPDATE_ACL; }
     break;
 
   case 2432:
 
 /* Line 1455 of yacc.c  */
-#line 14097 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14106 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2433:
 
 /* Line 1455 of yacc.c  */
-#line 14099 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14108 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->which_columns = REFERENCES_ACL;}
     break;
 
   case 2434:
 
 /* Line 1455 of yacc.c  */
-#line 14100 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14109 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2435:
 
 /* Line 1455 of yacc.c  */
-#line 14101 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14110 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= DELETE_ACL;}
     break;
 
   case 2436:
 
 /* Line 1455 of yacc.c  */
-#line 14102 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14111 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2437:
 
 /* Line 1455 of yacc.c  */
-#line 14103 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14112 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= INDEX_ACL;}
     break;
 
   case 2438:
 
 /* Line 1455 of yacc.c  */
-#line 14104 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14113 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= ALTER_ACL;}
     break;
 
   case 2439:
 
 /* Line 1455 of yacc.c  */
-#line 14105 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14114 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_ACL;}
     break;
 
   case 2440:
 
 /* Line 1455 of yacc.c  */
-#line 14106 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14115 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= DROP_ACL;}
     break;
 
   case 2441:
 
 /* Line 1455 of yacc.c  */
-#line 14107 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14116 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= EXECUTE_ACL;}
     break;
 
   case 2442:
 
 /* Line 1455 of yacc.c  */
-#line 14108 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14117 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= RELOAD_ACL;}
     break;
 
   case 2443:
 
 /* Line 1455 of yacc.c  */
-#line 14109 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14118 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= SHUTDOWN_ACL;}
     break;
 
   case 2444:
 
 /* Line 1455 of yacc.c  */
-#line 14110 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14119 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= PROCESS_ACL;}
     break;
 
   case 2445:
 
 /* Line 1455 of yacc.c  */
-#line 14111 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14120 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= FILE_ACL;}
     break;
 
   case 2446:
 
 /* Line 1455 of yacc.c  */
-#line 14112 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14121 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= GRANT_ACL;}
     break;
 
   case 2447:
 
 /* Line 1455 of yacc.c  */
-#line 14113 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14122 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= SHOW_DB_ACL;}
     break;
 
   case 2448:
 
 /* Line 1455 of yacc.c  */
-#line 14114 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14123 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= SUPER_ACL;}
     break;
 
   case 2449:
 
 /* Line 1455 of yacc.c  */
-#line 14115 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14124 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_TMP_ACL;}
     break;
 
   case 2450:
 
 /* Line 1455 of yacc.c  */
-#line 14116 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14125 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= LOCK_TABLES_ACL; }
     break;
 
   case 2451:
 
 /* Line 1455 of yacc.c  */
-#line 14117 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14126 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= REPL_SLAVE_ACL; }
     break;
 
   case 2452:
 
 /* Line 1455 of yacc.c  */
-#line 14118 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14127 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= REPL_CLIENT_ACL; }
     break;
 
   case 2453:
 
 /* Line 1455 of yacc.c  */
-#line 14119 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14128 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_VIEW_ACL; }
     break;
 
   case 2454:
 
 /* Line 1455 of yacc.c  */
-#line 14120 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14129 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= SHOW_VIEW_ACL; }
     break;
 
   case 2455:
 
 /* Line 1455 of yacc.c  */
-#line 14121 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14130 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_PROC_ACL; }
     break;
 
   case 2456:
 
 /* Line 1455 of yacc.c  */
-#line 14122 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14131 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= ALTER_PROC_ACL; }
     break;
 
   case 2457:
 
 /* Line 1455 of yacc.c  */
-#line 14123 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14132 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_USER_ACL; }
     break;
 
   case 2458:
 
 /* Line 1455 of yacc.c  */
-#line 14124 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14133 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= EVENT_ACL;}
     break;
 
   case 2459:
 
 /* Line 1455 of yacc.c  */
-#line 14125 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14134 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= TRIGGER_ACL; }
     break;
 
   case 2460:
 
 /* Line 1455 of yacc.c  */
-#line 14126 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14135 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= CREATE_TABLESPACE_ACL; }
     break;
 
   case 2461:
 
 /* Line 1455 of yacc.c  */
-#line 14130 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14139 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2462:
 
 /* Line 1455 of yacc.c  */
-#line 14131 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14140 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2465:
 
 /* Line 1455 of yacc.c  */
-#line 14141 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14150 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->x509_subject)
@@ -39332,7 +39341,7 @@ yyreduce:
   case 2466:
 
 /* Line 1455 of yacc.c  */
-#line 14151 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14160 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->x509_issuer)
@@ -39347,7 +39356,7 @@ yyreduce:
   case 2467:
 
 /* Line 1455 of yacc.c  */
-#line 14161 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14170 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (lex->ssl_cipher)
@@ -39362,7 +39371,7 @@ yyreduce:
   case 2468:
 
 /* Line 1455 of yacc.c  */
-#line 14174 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14183 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             size_t dummy;
@@ -39382,7 +39391,7 @@ yyreduce:
   case 2469:
 
 /* Line 1455 of yacc.c  */
-#line 14189 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14198 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->current_select->db = (yyvsp[(1) - (3)].lex_str).str;
@@ -39400,7 +39409,7 @@ yyreduce:
   case 2470:
 
 /* Line 1455 of yacc.c  */
-#line 14202 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14211 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->current_select->db = NULL;
@@ -39418,7 +39427,7 @@ yyreduce:
   case 2471:
 
 /* Line 1455 of yacc.c  */
-#line 14215 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14224 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!lex->current_select->add_table_to_list(lex->thd, (yyvsp[(1) - (1)].table),NULL,
@@ -39432,7 +39441,7 @@ yyreduce:
   case 2472:
 
 /* Line 1455 of yacc.c  */
-#line 14227 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14236 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->users_list.push_back((yyvsp[(1) - (1)].lex_user)))
               MYSQL_YYABORT;
@@ -39442,7 +39451,7 @@ yyreduce:
   case 2473:
 
 /* Line 1455 of yacc.c  */
-#line 14232 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14241 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->users_list.push_back((yyvsp[(3) - (3)].lex_user)))
               MYSQL_YYABORT;
@@ -39452,7 +39461,7 @@ yyreduce:
   case 2474:
 
 /* Line 1455 of yacc.c  */
-#line 14240 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14249 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->users_list.push_back((yyvsp[(1) - (1)].lex_user)))
               MYSQL_YYABORT;
@@ -39462,7 +39471,7 @@ yyreduce:
   case 2475:
 
 /* Line 1455 of yacc.c  */
-#line 14245 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14254 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (Lex->users_list.push_back((yyvsp[(3) - (3)].lex_user)))
               MYSQL_YYABORT;
@@ -39472,7 +39481,7 @@ yyreduce:
   case 2480:
 
 /* Line 1455 of yacc.c  */
-#line 14256 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14265 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_user)=(yyvsp[(1) - (4)].lex_user); (yyvsp[(1) - (4)].lex_user)->password=(yyvsp[(4) - (4)].lex_str);
             if ((yyvsp[(4) - (4)].lex_str).length)
@@ -39504,7 +39513,7 @@ yyreduce:
   case 2481:
 
 /* Line 1455 of yacc.c  */
-#line 14283 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14292 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             (yyval.lex_user)= (yyvsp[(1) - (5)].lex_user); 
             (yyvsp[(1) - (5)].lex_user)->password= (yyvsp[(5) - (5)].lex_str); 
@@ -39514,7 +39523,7 @@ yyreduce:
   case 2482:
 
 /* Line 1455 of yacc.c  */
-#line 14288 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14297 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_user)= (yyvsp[(1) - (4)].lex_user);
             (yyvsp[(1) - (4)].lex_user)->plugin= (yyvsp[(4) - (4)].lex_str);
@@ -39525,7 +39534,7 @@ yyreduce:
   case 2483:
 
 /* Line 1455 of yacc.c  */
-#line 14294 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14303 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.lex_user)= (yyvsp[(1) - (6)].lex_user);
             (yyvsp[(1) - (6)].lex_user)->plugin= (yyvsp[(4) - (6)].lex_str);
@@ -39536,14 +39545,14 @@ yyreduce:
   case 2484:
 
 /* Line 1455 of yacc.c  */
-#line 14300 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14309 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.lex_user)= (yyvsp[(1) - (1)].lex_user); (yyvsp[(1) - (1)].lex_user)->password= null_lex_str; }
     break;
 
   case 2485:
 
 /* Line 1455 of yacc.c  */
-#line 14305 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14314 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->grant |= lex->which_columns;
@@ -39553,7 +39562,7 @@ yyreduce:
   case 2489:
 
 /* Line 1455 of yacc.c  */
-#line 14319 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14328 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             String *new_str = new (thd->mem_root) String((const char*) (yyvsp[(1) - (1)].lex_str).str,(yyvsp[(1) - (1)].lex_str).length,system_charset_info);
             if (new_str == NULL)
@@ -39583,7 +39592,7 @@ yyreduce:
   case 2491:
 
 /* Line 1455 of yacc.c  */
-#line 14348 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14357 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->ssl_type=SSL_TYPE_SPECIFIED;
           }
@@ -39592,7 +39601,7 @@ yyreduce:
   case 2492:
 
 /* Line 1455 of yacc.c  */
-#line 14352 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14361 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->ssl_type=SSL_TYPE_ANY;
           }
@@ -39601,7 +39610,7 @@ yyreduce:
   case 2493:
 
 /* Line 1455 of yacc.c  */
-#line 14356 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14365 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->ssl_type=SSL_TYPE_X509;
           }
@@ -39610,7 +39619,7 @@ yyreduce:
   case 2494:
 
 /* Line 1455 of yacc.c  */
-#line 14360 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14369 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->ssl_type=SSL_TYPE_NONE;
           }
@@ -39619,49 +39628,49 @@ yyreduce:
   case 2495:
 
 /* Line 1455 of yacc.c  */
-#line 14366 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14375 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2497:
 
 /* Line 1455 of yacc.c  */
-#line 14371 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14380 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2498:
 
 /* Line 1455 of yacc.c  */
-#line 14372 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14381 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= GRANT_ACL;}
     break;
 
   case 2499:
 
 /* Line 1455 of yacc.c  */
-#line 14376 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14385 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2500:
 
 /* Line 1455 of yacc.c  */
-#line 14377 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14386 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2501:
 
 /* Line 1455 of yacc.c  */
-#line 14381 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14390 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->grant |= GRANT_ACL;}
     break;
 
   case 2502:
 
 /* Line 1455 of yacc.c  */
-#line 14383 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14392 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->mqh.questions=(yyvsp[(2) - (2)].ulong_num);
@@ -39672,7 +39681,7 @@ yyreduce:
   case 2503:
 
 /* Line 1455 of yacc.c  */
-#line 14389 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14398 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->mqh.updates=(yyvsp[(2) - (2)].ulong_num);
@@ -39683,7 +39692,7 @@ yyreduce:
   case 2504:
 
 /* Line 1455 of yacc.c  */
-#line 14395 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14404 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->mqh.conn_per_hour= (yyvsp[(2) - (2)].ulong_num);
@@ -39694,7 +39703,7 @@ yyreduce:
   case 2505:
 
 /* Line 1455 of yacc.c  */
-#line 14401 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14410 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->mqh.user_conn= (yyvsp[(2) - (2)].num);
@@ -39705,7 +39714,7 @@ yyreduce:
   case 2506:
 
 /* Line 1455 of yacc.c  */
-#line 14410 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14419 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command = SQLCOM_BEGIN;
@@ -39716,84 +39725,84 @@ yyreduce:
   case 2507:
 
 /* Line 1455 of yacc.c  */
-#line 14415 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14424 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2508:
 
 /* Line 1455 of yacc.c  */
-#line 14419 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14428 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2509:
 
 /* Line 1455 of yacc.c  */
-#line 14420 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14429 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2510:
 
 /* Line 1455 of yacc.c  */
-#line 14425 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14434 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_UNKNOWN; }
     break;
 
   case 2511:
 
 /* Line 1455 of yacc.c  */
-#line 14426 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14435 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_NO; }
     break;
 
   case 2512:
 
 /* Line 1455 of yacc.c  */
-#line 14427 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14436 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_YES; }
     break;
 
   case 2513:
 
 /* Line 1455 of yacc.c  */
-#line 14432 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14441 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_UNKNOWN; }
     break;
 
   case 2514:
 
 /* Line 1455 of yacc.c  */
-#line 14433 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14442 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_YES; }
     break;
 
   case 2515:
 
 /* Line 1455 of yacc.c  */
-#line 14434 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14443 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.m_yes_no_unk)= TVL_NO; }
     break;
 
   case 2516:
 
 /* Line 1455 of yacc.c  */
-#line 14438 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14447 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2517:
 
 /* Line 1455 of yacc.c  */
-#line 14439 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14448 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2518:
 
 /* Line 1455 of yacc.c  */
-#line 14444 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14453 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_COMMIT;
@@ -39807,7 +39816,7 @@ yyreduce:
   case 2519:
 
 /* Line 1455 of yacc.c  */
-#line 14456 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14465 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_ROLLBACK;
@@ -39821,7 +39830,7 @@ yyreduce:
   case 2520:
 
 /* Line 1455 of yacc.c  */
-#line 14466 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14475 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_ROLLBACK_TO_SAVEPOINT;
@@ -39832,7 +39841,7 @@ yyreduce:
   case 2521:
 
 /* Line 1455 of yacc.c  */
-#line 14475 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14484 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_SAVEPOINT;
@@ -39843,7 +39852,7 @@ yyreduce:
   case 2522:
 
 /* Line 1455 of yacc.c  */
-#line 14484 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14493 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             lex->sql_command= SQLCOM_RELEASE_SAVEPOINT;
@@ -39854,14 +39863,14 @@ yyreduce:
   case 2523:
 
 /* Line 1455 of yacc.c  */
-#line 14497 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14506 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2525:
 
 /* Line 1455 of yacc.c  */
-#line 14503 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14512 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (add_select_to_union_list(Lex, (bool)(yyvsp[(2) - (2)].num), TRUE))
               MYSQL_YYABORT;
@@ -39871,7 +39880,7 @@ yyreduce:
   case 2526:
 
 /* Line 1455 of yacc.c  */
-#line 14508 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14517 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               Remove from the name resolution context stack the context of the
@@ -39884,42 +39893,42 @@ yyreduce:
   case 2527:
 
 /* Line 1455 of yacc.c  */
-#line 14518 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14527 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 0; }
     break;
 
   case 2528:
 
 /* Line 1455 of yacc.c  */
-#line 14519 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14528 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 1; }
     break;
 
   case 2529:
 
 /* Line 1455 of yacc.c  */
-#line 14520 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14529 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)= 1; }
     break;
 
   case 2530:
 
 /* Line 1455 of yacc.c  */
-#line 14524 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14533 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.is_not_empty)= false; }
     break;
 
   case 2531:
 
 /* Line 1455 of yacc.c  */
-#line 14525 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14534 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.is_not_empty)= true; }
     break;
 
   case 2532:
 
 /* Line 1455 of yacc.c  */
-#line 14529 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14538 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             DBUG_ASSERT(lex->current_select->linkage != GLOBAL_OPTIONS_TYPE);
@@ -39939,7 +39948,7 @@ yyreduce:
   case 2533:
 
 /* Line 1455 of yacc.c  */
-#line 14544 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14553 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             thd->lex->current_select->no_table_names_allowed= 0;
             thd->where= "";
@@ -39949,28 +39958,28 @@ yyreduce:
   case 2536:
 
 /* Line 1455 of yacc.c  */
-#line 14556 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14565 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)=1; }
     break;
 
   case 2537:
 
 /* Line 1455 of yacc.c  */
-#line 14557 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14566 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)=1; }
     break;
 
   case 2538:
 
 /* Line 1455 of yacc.c  */
-#line 14558 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14567 "/home/buildbot/git/sql/sql_yacc.yy"
     { (yyval.num)=0; }
     break;
 
   case 2539:
 
 /* Line 1455 of yacc.c  */
-#line 14563 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14572 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             (yyval.select_lex)= Lex->current_select->master_unit()->first_select();
           }
@@ -39979,7 +39988,7 @@ yyreduce:
   case 2540:
 
 /* Line 1455 of yacc.c  */
-#line 14567 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14576 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             (yyval.select_lex)= Lex->current_select->master_unit()->first_select();
           }
@@ -39988,7 +39997,7 @@ yyreduce:
   case 2542:
 
 /* Line 1455 of yacc.c  */
-#line 14576 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14585 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (add_select_to_union_list(Lex, (bool)(yyvsp[(3) - (3)].num), FALSE))
               MYSQL_YYABORT;
@@ -39998,7 +40007,7 @@ yyreduce:
   case 2543:
 
 /* Line 1455 of yacc.c  */
-#line 14582 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14591 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->pop_context();
             (yyval.select_lex)= (yyvsp[(1) - (6)].select_lex);
@@ -40008,7 +40017,7 @@ yyreduce:
   case 2544:
 
 /* Line 1455 of yacc.c  */
-#line 14591 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14600 "/home/buildbot/git/sql/sql_yacc.yy"
     { 
             (yyval.select_lex)= (yyvsp[(2) - (3)].select_lex);
           }
@@ -40017,7 +40026,7 @@ yyreduce:
   case 2545:
 
 /* Line 1455 of yacc.c  */
-#line 14597 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14606 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
             if (!lex->expr_allows_subselect ||
@@ -40041,7 +40050,7 @@ yyreduce:
   case 2546:
 
 /* Line 1455 of yacc.c  */
-#line 14618 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14627 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex=Lex;
 
@@ -40069,14 +40078,14 @@ yyreduce:
   case 2551:
 
 /* Line 1455 of yacc.c  */
-#line 14653 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14662 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= SELECT_STRAIGHT_JOIN; }
     break;
 
   case 2552:
 
 /* Line 1455 of yacc.c  */
-#line 14655 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14664 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (check_simple_select())
               MYSQL_YYABORT;
@@ -40089,28 +40098,28 @@ yyreduce:
   case 2553:
 
 /* Line 1455 of yacc.c  */
-#line 14662 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14671 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= SELECT_DISTINCT; }
     break;
 
   case 2554:
 
 /* Line 1455 of yacc.c  */
-#line 14663 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14672 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= SELECT_SMALL_RESULT; }
     break;
 
   case 2555:
 
 /* Line 1455 of yacc.c  */
-#line 14664 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14673 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= SELECT_BIG_RESULT; }
     break;
 
   case 2556:
 
 /* Line 1455 of yacc.c  */
-#line 14666 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14675 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (check_simple_select())
               MYSQL_YYABORT;
@@ -40121,7 +40130,7 @@ yyreduce:
   case 2557:
 
 /* Line 1455 of yacc.c  */
-#line 14672 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14681 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             if (check_simple_select())
               MYSQL_YYABORT;
@@ -40132,35 +40141,35 @@ yyreduce:
   case 2558:
 
 /* Line 1455 of yacc.c  */
-#line 14677 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14686 "/home/buildbot/git/sql/sql_yacc.yy"
     { Select->options|= SELECT_ALL; }
     break;
 
   case 2559:
 
 /* Line 1455 of yacc.c  */
-#line 14688 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14697 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2560:
 
 /* Line 1455 of yacc.c  */
-#line 14690 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14699 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2561:
 
 /* Line 1455 of yacc.c  */
-#line 14692 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14701 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2575:
 
 /* Line 1455 of yacc.c  */
-#line 14725 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14734 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             /*
               We have to distinguish missing DEFINER-clause from case when
@@ -40176,7 +40185,7 @@ yyreduce:
   case 2576:
 
 /* Line 1455 of yacc.c  */
-#line 14739 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14748 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             thd->lex->definer= get_current_user(thd, (yyvsp[(3) - (3)].lex_user));
           }
@@ -40185,77 +40194,77 @@ yyreduce:
   case 2577:
 
 /* Line 1455 of yacc.c  */
-#line 14752 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14761 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2578:
 
 /* Line 1455 of yacc.c  */
-#line 14754 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14763 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2579:
 
 /* Line 1455 of yacc.c  */
-#line 14756 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14765 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2580:
 
 /* Line 1455 of yacc.c  */
-#line 14761 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14770 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_mode= VIEW_CREATE_OR_REPLACE; }
     break;
 
   case 2581:
 
 /* Line 1455 of yacc.c  */
-#line 14766 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14775 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; }
     break;
 
   case 2582:
 
 /* Line 1455 of yacc.c  */
-#line 14768 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14777 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
     break;
 
   case 2583:
 
 /* Line 1455 of yacc.c  */
-#line 14770 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14779 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
     break;
 
   case 2584:
 
 /* Line 1455 of yacc.c  */
-#line 14775 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14784 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_suid= VIEW_SUID_DEFAULT; }
     break;
 
   case 2585:
 
 /* Line 1455 of yacc.c  */
-#line 14777 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14786 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_suid= VIEW_SUID_DEFINER; }
     break;
 
   case 2586:
 
 /* Line 1455 of yacc.c  */
-#line 14779 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14788 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_suid= VIEW_SUID_INVOKER; }
     break;
 
   case 2587:
 
 /* Line 1455 of yacc.c  */
-#line 14784 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14793 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             lex->sql_command= SQLCOM_CREATE_VIEW;
@@ -40272,14 +40281,14 @@ yyreduce:
   case 2589:
 
 /* Line 1455 of yacc.c  */
-#line 14800 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14809 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2591:
 
 /* Line 1455 of yacc.c  */
-#line 14806 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14815 "/home/buildbot/git/sql/sql_yacc.yy"
     {
               Lex->view_list.push_back((LEX_STRING*)
               sql_memdup(&(yyvsp[(1) - (1)].lex_str), sizeof(LEX_STRING)));
@@ -40289,7 +40298,7 @@ yyreduce:
   case 2592:
 
 /* Line 1455 of yacc.c  */
-#line 14811 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14820 "/home/buildbot/git/sql/sql_yacc.yy"
     {
               Lex->view_list.push_back((LEX_STRING*)
               sql_memdup(&(yyvsp[(3) - (3)].lex_str), sizeof(LEX_STRING)));
@@ -40299,7 +40308,7 @@ yyreduce:
   case 2593:
 
 /* Line 1455 of yacc.c  */
-#line 14818 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14827 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->parsing_options.allows_variable= FALSE;
@@ -40313,7 +40322,7 @@ yyreduce:
   case 2594:
 
 /* Line 1455 of yacc.c  */
-#line 14827 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14836 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             uint len= YYLIP->get_cpp_ptr() - lex->create_view_select.str;
@@ -40331,35 +40340,35 @@ yyreduce:
   case 2597:
 
 /* Line 1455 of yacc.c  */
-#line 14848 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14857 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_check= VIEW_CHECK_NONE; }
     break;
 
   case 2598:
 
 /* Line 1455 of yacc.c  */
-#line 14850 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14859 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_check= VIEW_CHECK_CASCADED; }
     break;
 
   case 2599:
 
 /* Line 1455 of yacc.c  */
-#line 14852 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14861 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_check= VIEW_CHECK_CASCADED; }
     break;
 
   case 2600:
 
 /* Line 1455 of yacc.c  */
-#line 14854 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14863 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->create_view_check= VIEW_CHECK_LOCAL; }
     break;
 
   case 2601:
 
 /* Line 1455 of yacc.c  */
-#line 14871 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14880 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $8 */
             Lex->raw_trg_on_table_name_begin= YYLIP->get_tok_start();
           }
@@ -40368,7 +40377,7 @@ yyreduce:
   case 2602:
 
 /* Line 1455 of yacc.c  */
-#line 14877 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14886 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $12 */
             Lex->raw_trg_on_table_name_end= YYLIP->get_tok_start();
           }
@@ -40377,7 +40386,7 @@ yyreduce:
   case 2603:
 
 /* Line 1455 of yacc.c  */
-#line 14882 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14891 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $15 */
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -40411,7 +40420,7 @@ yyreduce:
   case 2604:
 
 /* Line 1455 of yacc.c  */
-#line 14911 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14920 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $17 */
             LEX *lex= Lex;
             sp_head *sp= lex->sphead;
@@ -40440,7 +40449,7 @@ yyreduce:
   case 2605:
 
 /* Line 1455 of yacc.c  */
-#line 14945 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14954 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             if (is_native_function(thd, & (yyvsp[(4) - (8)].lex_str)))
@@ -40461,7 +40470,7 @@ yyreduce:
   case 2606:
 
 /* Line 1455 of yacc.c  */
-#line 14962 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14971 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             if (is_native_function(thd, & (yyvsp[(3) - (7)].lex_str)))
@@ -40482,7 +40491,7 @@ yyreduce:
   case 2607:
 
 /* Line 1455 of yacc.c  */
-#line 14984 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 14993 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $5 */
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -40517,7 +40526,7 @@ yyreduce:
   case 2608:
 
 /* Line 1455 of yacc.c  */
-#line 15015 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15024 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $8 */
             Lex->sphead->m_param_end= YYLIP->get_cpp_tok_start();
           }
@@ -40526,7 +40535,7 @@ yyreduce:
   case 2609:
 
 /* Line 1455 of yacc.c  */
-#line 15019 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15028 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $10 */
             LEX *lex= Lex;
             lex->charset= NULL;
@@ -40540,7 +40549,7 @@ yyreduce:
   case 2610:
 
 /* Line 1455 of yacc.c  */
-#line 15028 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15037 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $12 */
             LEX *lex= Lex;
             sp_head *sp= lex->sphead;
@@ -40568,7 +40577,7 @@ yyreduce:
   case 2611:
 
 /* Line 1455 of yacc.c  */
-#line 15051 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15060 "/home/buildbot/git/sql/sql_yacc.yy"
     { /* $14 */
             LEX *lex= thd->lex;
             Lex_input_stream *lip= YYLIP;
@@ -40581,7 +40590,7 @@ yyreduce:
   case 2612:
 
 /* Line 1455 of yacc.c  */
-#line 15059 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15068 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
             sp_head *sp= lex->sphead;
@@ -40638,7 +40647,7 @@ yyreduce:
   case 2613:
 
 /* Line 1455 of yacc.c  */
-#line 15114 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15123 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             sp_head *sp;
@@ -40667,7 +40676,7 @@ yyreduce:
   case 2614:
 
 /* Line 1455 of yacc.c  */
-#line 15138 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15147 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             const char* tmp_param_begin;
 
@@ -40680,7 +40689,7 @@ yyreduce:
   case 2615:
 
 /* Line 1455 of yacc.c  */
-#line 15147 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15156 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
 
@@ -40692,7 +40701,7 @@ yyreduce:
   case 2616:
 
 /* Line 1455 of yacc.c  */
-#line 15154 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15163 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= thd->lex;
 
@@ -40704,7 +40713,7 @@ yyreduce:
   case 2617:
 
 /* Line 1455 of yacc.c  */
-#line 15161 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15170 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             sp_head *sp= lex->sphead;
@@ -40718,7 +40727,7 @@ yyreduce:
   case 2618:
 
 /* Line 1455 of yacc.c  */
-#line 15175 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15184 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_START;
           }
@@ -40727,7 +40736,7 @@ yyreduce:
   case 2619:
 
 /* Line 1455 of yacc.c  */
-#line 15179 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15188 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_END;
           }
@@ -40736,7 +40745,7 @@ yyreduce:
   case 2620:
 
 /* Line 1455 of yacc.c  */
-#line 15183 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15192 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_PREPARE;
           }
@@ -40745,7 +40754,7 @@ yyreduce:
   case 2621:
 
 /* Line 1455 of yacc.c  */
-#line 15187 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15196 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_COMMIT;
           }
@@ -40754,7 +40763,7 @@ yyreduce:
   case 2622:
 
 /* Line 1455 of yacc.c  */
-#line 15191 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15200 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_ROLLBACK;
           }
@@ -40763,7 +40772,7 @@ yyreduce:
   case 2623:
 
 /* Line 1455 of yacc.c  */
-#line 15195 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15204 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             Lex->sql_command = SQLCOM_XA_RECOVER;
           }
@@ -40772,7 +40781,7 @@ yyreduce:
   case 2624:
 
 /* Line 1455 of yacc.c  */
-#line 15202 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15211 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             MYSQL_YYABORT_UNLESS((yyvsp[(1) - (1)].string)->length() <= MAXGTRIDSIZE);
             if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
@@ -40784,7 +40793,7 @@ yyreduce:
   case 2625:
 
 /* Line 1455 of yacc.c  */
-#line 15209 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15218 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             MYSQL_YYABORT_UNLESS((yyvsp[(1) - (3)].string)->length() <= MAXGTRIDSIZE && (yyvsp[(3) - (3)].string)->length() <= MAXBQUALSIZE);
             if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
@@ -40796,7 +40805,7 @@ yyreduce:
   case 2626:
 
 /* Line 1455 of yacc.c  */
-#line 15216 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15225 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             MYSQL_YYABORT_UNLESS((yyvsp[(1) - (5)].string)->length() <= MAXGTRIDSIZE && (yyvsp[(3) - (5)].string)->length() <= MAXBQUALSIZE);
             if (!(Lex->xid=(XID *)thd->alloc(sizeof(XID))))
@@ -40808,84 +40817,84 @@ yyreduce:
   case 2627:
 
 /* Line 1455 of yacc.c  */
-#line 15225 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15234 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2628:
 
 /* Line 1455 of yacc.c  */
-#line 15226 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15235 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2629:
 
 /* Line 1455 of yacc.c  */
-#line 15230 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15239 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_NONE;        }
     break;
 
   case 2630:
 
 /* Line 1455 of yacc.c  */
-#line 15231 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15240 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_JOIN;        }
     break;
 
   case 2631:
 
 /* Line 1455 of yacc.c  */
-#line 15232 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15241 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_RESUME;      }
     break;
 
   case 2632:
 
 /* Line 1455 of yacc.c  */
-#line 15236 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15245 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_NONE;        }
     break;
 
   case 2633:
 
 /* Line 1455 of yacc.c  */
-#line 15237 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15246 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_ONE_PHASE;   }
     break;
 
   case 2634:
 
 /* Line 1455 of yacc.c  */
-#line 15242 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15251 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_NONE;        }
     break;
 
   case 2635:
 
 /* Line 1455 of yacc.c  */
-#line 15244 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15253 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_SUSPEND;     }
     break;
 
   case 2637:
 
 /* Line 1455 of yacc.c  */
-#line 15249 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15258 "/home/buildbot/git/sql/sql_yacc.yy"
     {}
     break;
 
   case 2638:
 
 /* Line 1455 of yacc.c  */
-#line 15250 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15259 "/home/buildbot/git/sql/sql_yacc.yy"
     { Lex->xa_opt=XA_FOR_MIGRATE; }
     break;
 
   case 2639:
 
 /* Line 1455 of yacc.c  */
-#line 15255 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15264 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_INSTALL_PLUGIN;
@@ -40897,7 +40906,7 @@ yyreduce:
   case 2640:
 
 /* Line 1455 of yacc.c  */
-#line 15262 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15271 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_INSTALL_PLUGIN;
@@ -40909,7 +40918,7 @@ yyreduce:
   case 2641:
 
 /* Line 1455 of yacc.c  */
-#line 15272 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15281 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
@@ -40920,7 +40929,7 @@ yyreduce:
   case 2642:
 
 /* Line 1455 of yacc.c  */
-#line 15278 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15287 "/home/buildbot/git/sql/sql_yacc.yy"
     {
             LEX *lex= Lex;
             lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
@@ -40932,7 +40941,7 @@ yyreduce:
   case 2643:
 
 /* Line 1455 of yacc.c  */
-#line 15289 "/home/buildbot/git/sql/sql_yacc.yy"
+#line 15298 "/home/buildbot/git/sql/sql_yacc.yy"
     {
 	  YYERROR;
 	}
@@ -40941,7 +40950,7 @@ yyreduce:
 
 
 /* Line 1455 of yacc.c  */
-#line 40945 "/home/buildbot/git/mkdist/sql/sql_yacc.cc"
+#line 40954 "/home/buildbot/git/mkdist/sql/sql_yacc.cc"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a49dea6..11d7efd 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -9872,6 +9872,15 @@ table_factor:
               sel->add_joined_table($$);
               lex->pop_context();
               lex->nest_level--;
+              /*
+                Fields in derived table can be used in upper select in
+                case of merge. We do not add HAVING fields because we do
+                not merge such derived. We do not add union because
+                also do not merge them
+              */
+              if (!sel->next_select())
+                $2->select_n_where_fields+=
+                  sel->select_n_where_fields;
             }
             /*else if (($3->select_lex &&
                       $3->select_lex->master_unit()->is_union() &&
diff --git a/sql/table.cc b/sql/table.cc
index f521056..db18214 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
    Copyright (c) 2008, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
@@ -2445,21 +2445,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
       outparam->record[1]= outparam->record[0];   // Safety
   }
 
-#ifdef HAVE_valgrind
-  /*
-    We need this because when we read var-length rows, we are not updating
-    bytes after end of varchar
-  */
-  if (records > 1)
-  {
-    memcpy(outparam->record[0], share->default_values, share->rec_buff_length);
-    memcpy(outparam->record[1], share->default_values, share->null_bytes);
-    if (records > 2)
-      memcpy(outparam->record[1], share->default_values,
-             share->rec_buff_length);
-  }
-#endif
-
   if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root,
                                           (uint) ((share->fields+1)*
                                                   sizeof(Field*)))))
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index c720213..adf4f0f 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1662,6 +1662,20 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked)
   DBUG_RETURN(0);
 }
 
+class Net_error_handler : public Internal_error_handler
+{
+public:
+  Net_error_handler() {}
+
+public:
+  bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
+                        MYSQL_ERROR::enum_warning_level level,
+                        const char* msg, MYSQL_ERROR ** cond_hdl)
+  {
+    return sql_errno >= ER_ABORTING_CONNECTION &&
+           sql_errno <= ER_NET_WRITE_INTERRUPTED;
+  }
+};
 
 /*
   Closes a table. We call the free_share() function to free any resources
@@ -1683,18 +1697,15 @@ int ha_federated::close(void)
   delete_dynamic(&results);
 
   /* Disconnect from mysql */
+  THD *thd= ha_thd();
+  Net_error_handler err_handler;
+  if (thd)
+    thd->push_internal_handler(&err_handler);
   mysql_close(mysql);
-  mysql= NULL;
+  if (thd)
+    thd->pop_internal_handler();
 
-  /*
-    mysql_close() might return an error if a remote server's gone
-    for some reason. If that happens while removing a table from
-    the table cache, the error will be propagated to a client even
-    if the original query was not issued against the FEDERATED table.
-    So, don't propagate errors from mysql_close().
-  */
-  if (table->in_use)
-    table->in_use->clear_error();
+  mysql= NULL;
 
   DBUG_RETURN(free_share(share));
 }
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 6219951..c9b07a8 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -1639,6 +1639,7 @@ error:
 }
 
 
+static federatedx_txn zero_txn;
 static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
 {
   bool destroy;
@@ -1654,12 +1655,9 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
     MEM_ROOT mem_root;
 
     if (!txn)
-    {
-      federatedx_txn tmp_txn;
-      tmp_txn.close(server);
-    }
-    else
-      txn->close(server);
+      txn= &zero_txn;
+
+    txn->close(server);
 
     DBUG_ASSERT(server->io_count == 0);
 
@@ -1678,7 +1676,7 @@ static int free_server(federatedx_txn *txn, FEDERATEDX_SERVER *server)
   free memory associated with it.
 */
 
-static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
+static void free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
 {
   bool destroy;
   DBUG_ENTER("free_share");
@@ -1701,7 +1699,7 @@ static int free_share(federatedx_txn *txn, FEDERATEDX_SHARE *share)
     free_server(txn, server);
   }
 
-  DBUG_RETURN(0);
+  DBUG_VOID_RETURN;
 }
 
 
@@ -1767,7 +1765,7 @@ int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd)
 int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
 {
   int error;
-  THD *thd= current_thd;
+  THD *thd= ha_thd();
   DBUG_ENTER("ha_federatedx::open");
 
   if (!(share= get_share(name, table)))
@@ -1797,6 +1795,20 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
   DBUG_RETURN(0);
 }
 
+class Net_error_handler : public Internal_error_handler
+{
+public:
+  Net_error_handler() {}
+
+public:
+  bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate,
+                        MYSQL_ERROR::enum_warning_level level,
+                        const char* msg, MYSQL_ERROR ** cond_hdl)
+  {
+    return sql_errno >= ER_ABORTING_CONNECTION &&
+           sql_errno <= ER_NET_WRITE_INTERRUPTED;
+  }
+};
 
 /*
   Closes a table. We call the free_share() function to free any resources
@@ -1811,8 +1823,8 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
 
 int ha_federatedx::close(void)
 {
-  int retval= 0, error;
-  THD *thd= current_thd;
+  int retval= 0;
+  THD *thd= ha_thd();
   DBUG_ENTER("ha_federatedx::close");
 
   /* free the result set */
@@ -1822,24 +1834,18 @@ int ha_federatedx::close(void)
 
   /* Disconnect from mysql */
   if (!thd || !(txn= get_txn(thd, true)))
-  {
-    federatedx_txn tmp_txn;
-
-    tmp_txn.release(&io);
+    txn= &zero_txn;
 
-    DBUG_ASSERT(io == NULL);
+  txn->release(&io);
+  DBUG_ASSERT(io == NULL);
 
-    if ((error= free_share(&tmp_txn, share)))
-      retval= error;
-  }
-  else
-  {
-    txn->release(&io);
-    DBUG_ASSERT(io == NULL);
+  Net_error_handler err_handler;
+  if (thd)
+    thd->push_internal_handler(&err_handler);
+  free_share(txn, share);
+  if (thd)
+    thd->pop_internal_handler();
 
-    if ((error= free_share(txn, share)))
-      retval= error;
-  }
   DBUG_RETURN(retval);
 }
 
@@ -1862,9 +1868,8 @@ int ha_federatedx::close(void)
       0    otherwise
 */
 
-static inline uint field_in_record_is_null(TABLE *table,
-                                    Field *field,
-                                    char *record)
+static inline uint field_in_record_is_null(TABLE *table, Field *field,
+                                           char *record)
 {
   int null_offset;
   DBUG_ENTER("ha_federatedx::field_in_record_is_null");
@@ -2203,7 +2208,7 @@ int ha_federatedx::end_bulk_insert()
 */
 void ha_federatedx::update_auto_increment(void)
 {
-  THD *thd= current_thd;
+  THD *thd= ha_thd();
   DBUG_ENTER("ha_federatedx::update_auto_increment");
 
   ha_federatedx::info(HA_STATUS_AUTO);
@@ -3058,7 +3063,7 @@ error:
 int ha_federatedx::info(uint flag)
 {
   uint error_code;
-  THD *thd= current_thd;
+  THD *thd= ha_thd();
   federatedx_txn *tmp_txn;
   federatedx_io *tmp_io= 0, **iop= 0;
   DBUG_ENTER("ha_federatedx::info");
@@ -3189,7 +3194,7 @@ int ha_federatedx::reset(void)
     federatedx_io *tmp_io= 0, **iop;
 
     // external_lock may not have been called so txn may not be set
-    tmp_txn= get_txn(current_thd);
+    tmp_txn= get_txn(ha_thd());
 
     if (!*(iop= &io) && (error= tmp_txn->acquire(share, TRUE, (iop= &tmp_io))))
     {
@@ -3364,7 +3369,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
                          HA_CREATE_INFO *create_info)
 {
   int retval;
-  THD *thd= current_thd;
+  THD *thd= ha_thd();
   FEDERATEDX_SHARE tmp_share; // Only a temporary share, to test the url
   federatedx_txn *tmp_txn;
   federatedx_io *tmp_io= NULL;
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index dcbca49..dcce3c1 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -1140,7 +1140,7 @@ dict_create_index_step(
 			>= DICT_TF_FORMAT_ZIP);
 
 		node->index = dict_index_get_if_in_cache_low(index_id);
-		ut_a(!node->index == (err != DB_SUCCESS));
+		ut_a(err == DB_SUCCESS ? node->index != NULL : node->index == NULL);
 
 		if (err != DB_SUCCESS) {
 
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index ad90038..17e9eb1 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -3628,13 +3628,13 @@ dict_foreign_push_index_error(
 			"%s table '%s' with foreign key constraint"
 			" failed. There is no index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.\n",
+			" as the first columns near '%s'.\n",
 			operation, create_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table '%s' with foreign key constraint"
 			" failed. There is no index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.",
+			" as the first columns near '%s'.",
 			operation, create_name, latest_foreign);
 		break;
 	}
@@ -3643,13 +3643,13 @@ dict_foreign_push_index_error(
 			"%s table '%s' with foreign key constraint"
 			" failed. There is only prefix index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.\n",
+			" as the first columns near '%s'.\n",
 			operation, create_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table '%s' with foreign key constraint"
 			" failed. There is only prefix index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.",
+			" as the first columns near '%s'.",
 			operation, create_name, latest_foreign);
 		break;
 	}
@@ -3657,12 +3657,12 @@ dict_foreign_push_index_error(
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
 			" failed. You have defined a SET NULL condition but "
-			"field %s on index is defined as NOT NULL close to %s\n",
+			"column '%s' on index is defined as NOT NULL near '%s'.\n",
 			operation, create_name, columns[err_col], latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
 			" failed. You have defined a SET NULL condition but "
-			"field %s on index is defined as NOT NULL close to %s",
+			"column '%s' on index is defined as NOT NULL near '%s'.",
 			operation, create_name, columns[err_col], latest_foreign);
 		break;
 	}
@@ -3675,13 +3675,13 @@ dict_foreign_push_index_error(
 			table, dict_col_get_no(field->col));
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Field type or character set for column %s "
-			"does not mach referenced column %s close to %s\n",
+			" failed. Field type or character set for column '%s' "
+			"does not mach referenced column '%s' near '%s'.\n",
 			operation, create_name, columns[err_col], col_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Field type or character set for column %s "
-			"does not mach referenced column %s close to %s",
+			" failed. Field type or character set for column '%s' "
+			"does not mach referenced column '%s' near '%s'.",
 			operation, create_name, columns[err_col], col_name, latest_foreign);
 		break;
 	}
@@ -3973,14 +3973,14 @@ loop:
 		if (!success) {
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, orig);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, orig);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4009,16 +4009,16 @@ col_loop1:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4038,14 +4038,14 @@ col_loop1:
 	if (!success) {
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4081,14 +4081,14 @@ col_loop1:
 	if (!success || !my_isspace(cs, *ptr)) {
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4148,7 +4148,7 @@ col_loop1:
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
-			"close to %s.",
+			"near '%s'.",
 			operation, create_name, buf, start_of_latest_foreign);
 
 		dict_foreign_free(foreign);
@@ -4157,7 +4157,7 @@ col_loop1:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
-			"close to %s.\n",
+			"near '%s'.\n",
 			operation, create_name, buf, start_of_latest_foreign);
 
 		mutex_exit(&dict_foreign_err_mutex);
@@ -4172,14 +4172,14 @@ col_loop1:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4201,16 +4201,16 @@ col_loop2:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4228,14 +4228,12 @@ col_loop2:
 
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s. Too few referenced columns.\n",
+			" failed. Parse error in '%s' near '%s'.  Referencing column count does not match referenced column count.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s. Too few referenced columns, you have %d when you should have %d.",
+			" failed. Parse error in '%s' near '%s'.  Referencing column count %d does not match referenced column count %d.\n",
 			operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
 
 		dict_foreign_free(foreign);
@@ -4268,14 +4266,14 @@ scan_on_conditions:
 
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4316,14 +4314,14 @@ scan_on_conditions:
 			dict_foreign_free(foreign);
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4345,14 +4343,14 @@ scan_on_conditions:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4365,14 +4363,14 @@ scan_on_conditions:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4392,16 +4390,16 @@ scan_on_conditions:
 			dict_foreign_error_report_low(ef, create_name);
 			fprintf(ef,
 				"%s table %s with foreign key constraint"
-				" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
-				" in %s close to %s.\n",
+				" failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+				" in '%s' near '%s'.\n",
 				operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
 			mutex_exit(&dict_foreign_err_mutex);
 
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
-				" in %s close to %s.",
+				" failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+				" in '%s' near '%s'.",
 				operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
 
 			dict_foreign_free(foreign);
@@ -4427,14 +4425,14 @@ try_find_index:
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
 			" failed. You have more than one on delete or on update clause"
-			" in %s close to %s.\n",
+			" in '%s' near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
 			" failed. You have more than one on delete or on update clause"
-			" in %s close to %s.",
+			" in '%s' near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		dict_foreign_free(foreign);
 		return(DB_CANNOT_ADD_CONSTRAINT);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2bdbdf7..f2a2eec 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1504,10 +1504,11 @@ innobase_next_autoinc(
 	if (next_value == 0) {
 		ulonglong	next;
 
-		if (current > offset) {
+		if (current >= offset) {
 			next = (current - offset) / step;
 		} else {
-			next = (offset - current) / step;
+			next = 0;
+			block -= step;
 		}
 
 		ut_a(max_value > next);
@@ -4053,7 +4054,7 @@ ha_innobase::open(
 				}
 
 				ib_table = dict_table_get(
-					par_case_name, FALSE, ignore_err);
+					par_case_name, TRUE, ignore_err);
 			}
 			if (ib_table) {
 #ifndef __WIN__
@@ -5214,9 +5215,9 @@ ha_innobase::write_row(
 	DBUG_ENTER("ha_innobase::write_row");
 
 	if (prebuilt->trx != trx) {
-	  sql_print_error("The transaction object for the table handle is at "
-			  "%p, but for the current thread it is at %p",
-			  (const void*) prebuilt->trx, (const void*) trx);
+		sql_print_error("The transaction object for the table handle is at "
+			"%p, but for the current thread it is at %p",
+			(const void*) prebuilt->trx, (const void*) trx);
 
 		fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
 		ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
@@ -6648,7 +6649,8 @@ create_table_def(
 
 	/* MySQL does the name length check. But we do additional check
 	on the name length here */
-	if (strlen(table_name) > MAX_FULL_NAME_LEN) {
+	const size_t	table_name_len = strlen(table_name);
+	if (table_name_len > MAX_FULL_NAME_LEN) {
 		push_warning_printf(
 			(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			ER_TABLE_NAME,
@@ -6657,6 +6659,15 @@ create_table_def(
 		DBUG_RETURN(ER_TABLE_NAME);
 	}
 
+	if (table_name[table_name_len - 1] == '/') {
+		push_warning_printf(
+			(THD*) trx->mysql_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+			ER_TABLE_NAME,
+			"InnoDB: Table name is empty");
+
+		DBUG_RETURN(ER_WRONG_TABLE_NAME);
+	}
+
 	n_cols = form->s->fields;
 
 	/* We pass 0 as the space id, and determine at a lower level the space
@@ -10445,15 +10456,12 @@ ha_innobase::get_auto_increment(
 
 		current = *first_value;
 
-		/* If the increment step of the auto increment column
-		decreases then it is not affecting the immediate
-		next value in the series. */
-		if (prebuilt->autoinc_increment > increment) {
+		if (prebuilt->autoinc_increment != increment) {
 
 			current = autoinc - prebuilt->autoinc_increment;
 
 			current = innobase_next_autoinc(
-				current, 1, increment, 1, col_max_value);
+				current, 1, increment, offset, col_max_value);
 
 			dict_table_autoinc_initialize(prebuilt->table, current);
 
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 4615768..da3ea78 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -736,6 +736,10 @@ not_consistent:
 
 		fprintf(stderr,
 			"InnoDB: No valid checkpoint found.\n"
+			"InnoDB: If you are attempting downgrade"
+			" from MySQL 5.7.9 or later,\n"
+			"InnoDB: please refer to " REFMAN
+			"upgrading-downgrading.html\n"
 			"InnoDB: If this error appears when you are"
 			" creating an InnoDB database,\n"
 			"InnoDB: the problem may be that during"
@@ -1763,7 +1767,7 @@ loop:
 		goto loop;
 	}
 
-	ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
+	ut_ad(allow_ibuf == FALSE ? mutex_own(&log_sys->mutex) : !mutex_own(&log_sys->mutex));
 
 	if (!allow_ibuf) {
 		recv_no_ibuf_operations = TRUE;
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index d4cc313..bdd932b 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -1,5 +1,6 @@
 /*
-   Copyright (c) 2000, 2011, Oracle and/or its affiliates
+   Copyright (c) 2000, 2015, Oracle and/or its affiliates
+   Copyright (c) 2010, 2015, MariaDB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -473,7 +474,6 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
     key_del[i]=HA_OFFSET_ERROR;
 
   unique_key_parts=0;
-  offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;
   for (i=0, uniquedef=uniquedefs ; i < uniques ; i++ , uniquedef++)
   {
     uniquedef->key=keys+i;
@@ -739,7 +739,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
 #endif
   }
   /* Create extra keys for unique definitions */
-  offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;
+  offset=real_reclength - uniques * MI_UNIQUE_HASH_LENGTH;
   bzero((char*) &tmp_keydef,sizeof(tmp_keydef));
   bzero((char*) &tmp_keyseg,sizeof(tmp_keyseg));
   for (i=0; i < uniques ; i++)
diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc
index 45bd44e..42c0db8 100644
--- a/storage/tokudb/hatoku_cmp.cc
+++ b/storage/tokudb/hatoku_cmp.cc
@@ -3140,189 +3140,3 @@ static uint32_t pack_key_from_desc(
     return (uint32_t)(packed_key_pos - buf); // 
 }
 
-static bool fields_have_same_name(Field* a, Field* b) {
-    return strcmp(a->field_name, b->field_name) == 0;
-}
-
-static bool fields_are_same_type(Field* a, Field* b) {
-    bool retval = true;
-    enum_field_types a_mysql_type = a->real_type();
-    enum_field_types b_mysql_type = b->real_type();
-    TOKU_TYPE a_toku_type = mysql_to_toku_type(a);
-    TOKU_TYPE b_toku_type = mysql_to_toku_type(b);
-    // make sure have same names
-    // make sure have same types
-    if (a_mysql_type != b_mysql_type) {
-        retval = false;
-        goto cleanup;
-    }
-    // Thanks to MariaDB 5.5, we can have two fields
-    // be the same MySQL type but not the same toku type,
-    // This is an issue introduced with MariaDB's fractional time
-    // implementation
-    if (a_toku_type != b_toku_type) {
-        retval = false;
-        goto cleanup;
-    }
-    // make sure that either both are nullable, or both not nullable
-    if ((a->null_bit && !b->null_bit) || (!a->null_bit && b->null_bit)) {
-        retval = false;
-        goto cleanup;
-    }
-    switch (a_mysql_type) {
-    case MYSQL_TYPE_TINY:
-    case MYSQL_TYPE_SHORT:
-    case MYSQL_TYPE_INT24:
-    case MYSQL_TYPE_LONG:
-    case MYSQL_TYPE_LONGLONG:
-        // length, unsigned, auto increment
-        if (a->pack_length() != b->pack_length() ||
-            (a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
-            (a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_DOUBLE:
-    case MYSQL_TYPE_FLOAT:
-        // length, unsigned, auto increment
-        if (a->pack_length() != b->pack_length() ||
-            (a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
-            (a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_NEWDECIMAL:
-        // length, unsigned
-        if (a->pack_length() != b->pack_length() ||
-            (a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG)) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_ENUM: {
-        Field_enum *a_enum = static_cast<Field_enum *>(a);
-        if (!a_enum->eq_def(b)) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    }   
-    case MYSQL_TYPE_SET: {
-        Field_set *a_set = static_cast<Field_set *>(a);
-        if (!a_set->eq_def(b)) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    }
-    case MYSQL_TYPE_BIT:
-        // length
-        if (a->pack_length() != b->pack_length()) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_DATE:
-    case MYSQL_TYPE_DATETIME:
-    case MYSQL_TYPE_YEAR:
-    case MYSQL_TYPE_NEWDATE:
-    case MYSQL_TYPE_TIME:
-    case MYSQL_TYPE_TIMESTAMP:
-#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
-    (50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) || \
-    (100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099)
-    case MYSQL_TYPE_DATETIME2:
-    case MYSQL_TYPE_TIMESTAMP2:
-    case MYSQL_TYPE_TIME2:
-#endif
-        // length
-        if (a->pack_length() != b->pack_length()) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_TINY_BLOB:
-    case MYSQL_TYPE_MEDIUM_BLOB:
-    case MYSQL_TYPE_BLOB:
-    case MYSQL_TYPE_LONG_BLOB:
-        // test the charset
-        if (a->charset()->number != b->charset()->number) {
-            retval = false;
-            goto cleanup;            
-        }
-        if (a->row_pack_length() != b->row_pack_length()) {
-            retval = false;
-            goto cleanup;
-        }
-        break;
-    case MYSQL_TYPE_STRING:
-        if (a->pack_length() != b->pack_length()) {
-            retval = false;
-            goto cleanup;
-        }
-        // if both are binary, we know have same pack lengths,
-        // so we can goto end
-        if (a->binary() && b->binary()) {
-            // nothing to do, we are good
-        }
-        else if (!a->binary() && !b->binary()) {
-            // test the charset
-            if (a->charset()->number != b->charset()->number) {
-                retval = false;
-                goto cleanup;            
-            }
-        }
-        else {
-            // one is binary and the other is not, so not the same
-            retval = false;
-            goto cleanup;
-        }        
-        break;
-    case MYSQL_TYPE_VARCHAR:
-        if (a->field_length != b->field_length) {
-            retval = false;
-            goto cleanup;
-        }
-        // if both are binary, we know have same pack lengths,
-        // so we can goto end
-        if (a->binary() && b->binary()) {
-            // nothing to do, we are good
-        }
-        else if (!a->binary() && !b->binary()) {
-            // test the charset
-            if (a->charset()->number != b->charset()->number) {
-                retval = false;
-                goto cleanup;            
-            }
-        }
-        else {
-            // one is binary and the other is not, so not the same
-            retval = false;
-            goto cleanup;
-        }        
-        break;
-    //
-    // I believe these are old types that are no longer
-    // in any 5.1 tables, so tokudb does not need
-    // to worry about them
-    // Putting in this assert in case I am wrong.
-    // Do not support geometry yet.
-    //
-    case MYSQL_TYPE_GEOMETRY:
-    case MYSQL_TYPE_DECIMAL:
-    case MYSQL_TYPE_VAR_STRING:
-    case MYSQL_TYPE_NULL:
-        assert(false);
-    }
-
-cleanup:
-    return retval;
-}
-
-static bool are_two_fields_same(Field* a, Field* b) {
-    return fields_have_same_name(a, b) && fields_are_same_type(a, b);
-}
-
-
diff --git a/storage/tokudb/hatoku_cmp.h b/storage/tokudb/hatoku_cmp.h
index 6ecd096..af77d4d 100644
--- a/storage/tokudb/hatoku_cmp.h
+++ b/storage/tokudb/hatoku_cmp.h
@@ -208,10 +208,6 @@ static bool is_variable_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
     return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_VARIABLE_FIELD;
 }
 
-static bool is_blob_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
-    return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_BLOB_FIELD;
-}
-
 static bool field_valid_for_tokudb_table(Field* field);
 
 static void get_var_field_info(
@@ -472,20 +468,5 @@ static uint32_t pack_key_from_desc(
     const DBT* pk_val
     );
 
-static bool fields_have_same_name(
-    Field* a,
-    Field* b
-    );
-
-static bool fields_are_same_type(
-    Field* a, 
-    Field* b
-    );
-
-static bool are_two_fields_same(
-    Field* a,
-    Field* b
-    );
-
 #endif
 
diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h
index 71d78e5..b74e997 100644
--- a/storage/tokudb/hatoku_hton.h
+++ b/storage/tokudb/hatoku_hton.h
@@ -193,10 +193,6 @@ static MYSQL_THDVAR_BOOL(disable_slow_alter,
     false
 );
 
-static bool get_disable_slow_alter(THD* thd) {
-    return (THDVAR(thd, disable_slow_alter) != 0);
-}
-
 static MYSQL_THDVAR_BOOL(disable_hot_alter,
     0,
     "if on, hot alter table is disabled",
@@ -205,10 +201,6 @@ static MYSQL_THDVAR_BOOL(disable_hot_alter,
     false
 );
 
-static bool get_disable_hot_alter(THD* thd) {
-    return THDVAR(thd, disable_hot_alter) != 0;
-}
-
 static MYSQL_THDVAR_BOOL(create_index_online,
     0,
     "if on, create index done online",
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index 2f8e424..fe86358 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
 # 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -136,6 +136,18 @@ IF(NOT CMAKE_CROSSCOMPILING)
   }"
   HAVE_IB_GCC_ATOMIC_THREAD_FENCE
   )
+  CHECK_C_SOURCE_RUNS(
+  "#include<stdint.h>
+  int main()
+  {
+    unsigned char	c;
+
+    __atomic_test_and_set(&c, __ATOMIC_ACQUIRE);
+    __atomic_clear(&c, __ATOMIC_RELEASE);
+    return(0);
+  }"
+  HAVE_IB_GCC_ATOMIC_TEST_AND_SET
+  )
 ENDIF()
 
 IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
@@ -145,6 +157,9 @@ ENDIF()
 IF(HAVE_IB_GCC_ATOMIC_BUILTINS_64)
  ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS_64=1)
 ENDIF()
+IF(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
+ ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_TEST_AND_SET=1)
+ENDIF()
 
 IF(HAVE_IB_GCC_SYNC_SYNCHRONISE)
  ADD_DEFINITIONS(-DHAVE_IB_GCC_SYNC_SYNCHRONISE=1)
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index be12bf6..0ec9367 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, Google Inc.
 
 Portions of this file contain modifications contributed and copyrighted by
@@ -318,7 +318,12 @@ btr_cur_latch_leaves(
 
 				ut_a(page_is_comp(get_block->frame)
 					== page_is_comp(page));
-				ut_a(btr_page_get_next(get_block->frame, mtr)
+
+				/* For fake_change mode we avoid a detailed validation
+				as it operate in tweaked format where-in validation
+				may fail. */
+				ut_a(sibling_mode == RW_NO_LATCH
+				     || btr_page_get_next(get_block->frame, mtr)
 					== page_get_page_no(page));
 			}
 #endif /* UNIV_BTR_DEBUG */
@@ -2228,6 +2233,7 @@ btr_cur_optimistic_update(
 	ulint		max_size;
 	ulint		new_rec_size;
 	ulint		old_rec_size;
+	ulint		max_ins_size = 0;
 	dtuple_t*	new_entry;
 	roll_ptr_t	roll_ptr;
 	trx_t*		trx;
@@ -2339,6 +2345,11 @@ any_extern:
 		: (old_rec_size
 		   + page_get_max_insert_size_after_reorganize(page, 1));
 
+	if (!page_zip) {
+		max_ins_size = page_get_max_insert_size_after_reorganize(
+					page, 1);
+	}
+
 	if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
 	       && (max_size >= new_rec_size))
 	      || (page_get_n_recs(page) <= 1))) {
@@ -2395,10 +2406,14 @@ any_extern:
 	rec = btr_cur_insert_if_possible(cursor, new_entry, 0/*n_ext*/, mtr);
 	ut_a(rec); /* <- We calculated above the insert would fit */
 
-	if (page_zip && !dict_index_is_clust(index)
+	if (!dict_index_is_clust(index)
 	    && page_is_leaf(page)) {
 		/* Update the free bits in the insert buffer. */
-		ibuf_update_free_bits_zip(block, mtr);
+		if (page_zip) {
+			ibuf_update_free_bits_zip(block, mtr);
+		} else {
+			ibuf_update_free_bits_low(block, max_ins_size, mtr);
+		}
 	}
 
 	/* Restore the old explicit lock state on the record */
@@ -2507,6 +2522,7 @@ btr_cur_pessimistic_update(
 	ulint		n_reserved;
 	ulint		n_ext;
 	ulint*		offsets		= NULL;
+	ulint		max_ins_size	= 0;
 
 	*big_rec = NULL;
 
@@ -2659,6 +2675,11 @@ make_external:
 		/* skip CHANGE, LOG */
 		err = DB_SUCCESS;
 		goto return_after_reservations;
+  }
+
+  if (!page_zip) {
+		max_ins_size = page_get_max_insert_size_after_reorganize(
+					page, 1);
 	}
 
 	/* Store state of explicit locks on rec on the page infimum record,
@@ -2706,10 +2727,15 @@ make_external:
 			big_rec_vec != NULL && (flags & BTR_KEEP_POS_FLAG),
 			mtr);
 
-		if (page_zip && !dict_index_is_clust(index)
+		if (!dict_index_is_clust(index)
 		    && page_is_leaf(page)) {
 			/* Update the free bits in the insert buffer. */
-			ibuf_update_free_bits_zip(block, mtr);
+			if (page_zip) {
+				ibuf_update_free_bits_zip(block, mtr);
+			} else {
+				ibuf_update_free_bits_low(block, max_ins_size,
+							  mtr);
+			}
 		}
 
 		err = DB_SUCCESS;
@@ -4016,7 +4042,14 @@ btr_estimate_number_of_different_key_vals(
 
 		page = btr_cur_get_page(&cursor);
 
-		SRV_CORRUPT_TABLE_CHECK(page, goto exit_loop;);
+		DBUG_EXECUTE_IF("ib_corrupt_page_while_stats_calc",
+				page = NULL;);
+
+		SRV_CORRUPT_TABLE_CHECK(page,
+		{
+			mtr_commit(&mtr);
+			goto exit_loop;
+		});
 
 		rec = page_rec_get_next(page_get_infimum_rec(page));
 
diff --git a/storage/xtradb/dict/dict0crea.c b/storage/xtradb/dict/dict0crea.c
index f7663b9..4c1c4f1 100644
--- a/storage/xtradb/dict/dict0crea.c
+++ b/storage/xtradb/dict/dict0crea.c
@@ -1255,7 +1255,7 @@ dict_create_index_step(
 			>= DICT_TF_FORMAT_ZIP);
 
 		node->index = dict_index_get_if_in_cache_low(index_id);
-		ut_a(!node->index == (err != DB_SUCCESS));
+		ut_a((node->index == 0) == (err != DB_SUCCESS));
 
 		if (err != DB_SUCCESS) {
 
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index cd8e415..7351de5 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -3762,13 +3762,13 @@ dict_foreign_push_index_error(
 			"%s table '%s' with foreign key constraint"
 			" failed. There is no index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.\n",
+			" as the first columns near '%s'.\n",
 			operation, create_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table '%s' with foreign key constraint"
 			" failed. There is no index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.",
+			" as the first columns near '%s'.",
 			operation, create_name, latest_foreign);
 		break;
 	}
@@ -3777,13 +3777,13 @@ dict_foreign_push_index_error(
 			"%s table '%s' with foreign key constraint"
 			" failed. There is only prefix index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.\n",
+			" as the first columns near '%s'.\n",
 			operation, create_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table '%s' with foreign key constraint"
 			" failed. There is only prefix index in the referenced"
 			" table where the referenced columns appear"
-			" as the first columns. Error close to %s.",
+			" as the first columns near '%s'.",
 			operation, create_name, latest_foreign);
 		break;
 	}
@@ -3791,12 +3791,12 @@ dict_foreign_push_index_error(
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
 			" failed. You have defined a SET NULL condition but "
-			"field %s on index is defined as NOT NULL close to %s\n",
+			"column '%s' on index is defined as NOT NULL near '%s'.\n",
 			operation, create_name, columns[err_col], latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
 			" failed. You have defined a SET NULL condition but "
-			"field %s on index is defined as NOT NULL close to %s",
+			"column '%s' on index is defined as NOT NULL near '%s'.",
 			operation, create_name, columns[err_col], latest_foreign);
 		break;
 	}
@@ -3809,13 +3809,13 @@ dict_foreign_push_index_error(
 			table, dict_col_get_no(field->col));
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Field type or character set for column %s "
-			"does not mach referenced column %s close to %s\n",
+			" failed. Field type or character set for column '%s' "
+			"does not mach referenced column '%s' near '%s'.\n",
 			operation, create_name, columns[err_col], col_name, latest_foreign);
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Field type or character set for column %s "
-			"does not mach referenced column %s close to %s",
+			" failed. Field type or character set for column '%s' "
+			"does not mach referenced column '%s' near '%s'.",
 			operation, create_name, columns[err_col], col_name, latest_foreign);
 		break;
 	}
@@ -4107,14 +4107,14 @@ loop:
 		if (!success) {
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, orig);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, orig);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4143,16 +4143,16 @@ col_loop1:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4172,14 +4172,14 @@ col_loop1:
 	if (!success) {
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4215,14 +4215,14 @@ col_loop1:
 	if (!success || !my_isspace(cs, *ptr)) {
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4282,7 +4282,7 @@ col_loop1:
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
-			"close to %s.",
+			"near '%s'.",
 			operation, create_name, buf, start_of_latest_foreign);
 
 		dict_foreign_free(foreign);
@@ -4291,7 +4291,7 @@ col_loop1:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint failed. Referenced table %s not found in the data dictionary "
-			"close to %s.\n",
+			"near '%s'.\n",
 			operation, create_name, buf, start_of_latest_foreign);
 
 		mutex_exit(&dict_foreign_err_mutex);
@@ -4306,14 +4306,14 @@ col_loop1:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4335,16 +4335,16 @@ col_loop2:
 		dict_foreign_error_report_low(ef, create_name);
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, orig);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4362,14 +4362,12 @@ col_loop2:
 
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s. Too few referenced columns\n",
+			" failed. Parse error in '%s' near '%s'.  Referencing column count does not match referenced column count.\n",
 			operation, create_name, start_of_latest_foreign, orig);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s. Too few referenced columns, you have %d when you should have %d.",
+			" failed. Parse error in '%s' near '%s'.  Referencing column count %d does not match referenced column count %d.\n",
 			operation, create_name, start_of_latest_foreign, orig, i, foreign->n_fields);
 
 		dict_foreign_free(foreign);
@@ -4402,14 +4400,14 @@ scan_on_conditions:
 
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4450,14 +4448,14 @@ scan_on_conditions:
 			dict_foreign_free(foreign);
 			dict_foreign_report_syntax_err(
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.\n",
+				" failed. Parse error in '%s'"
+				" near '%s'.\n",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. Foreign key constraint parse error in %s"
-				" close to %s.",
+				" failed. Parse error in '%s'"
+				" near '%s'.",
 				operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 			return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4479,14 +4477,14 @@ scan_on_conditions:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		return(DB_CANNOT_ADD_CONSTRAINT);
@@ -4499,14 +4497,14 @@ scan_on_conditions:
 		dict_foreign_free(foreign);
 		dict_foreign_report_syntax_err(
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.\n",
+			" failed. Parse error in '%s'"
+			" near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
-			" failed. Foreign key constraint parse error in %s"
-			" close to %s.",
+			" failed. Parse error in '%s'"
+			" near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		return(DB_CANNOT_ADD_CONSTRAINT);
 	}
@@ -4526,16 +4524,16 @@ scan_on_conditions:
 			dict_foreign_error_report_low(ef, create_name);
 			fprintf(ef,
 				"%s table %s with foreign key constraint"
-				" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
-				" in %s close to %s.\n",
+				" failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+				" in '%s' near '%s'.\n",
 				operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
 			mutex_exit(&dict_foreign_err_mutex);
 
 
 			ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 				"%s table %s with foreign key constraint"
-				" failed. You have defined a SET NULL condition but column %s is defined as NOT NULL"
-				" in %s close to %s.",
+				" failed. You have defined a SET NULL condition but column '%s' is defined as NOT NULL"
+				" in '%s' near '%s'.",
 				operation, create_name, col_name, start_of_latest_foreign, start_of_latest_set);
 
 			dict_foreign_free(foreign);
@@ -4561,14 +4559,14 @@ try_find_index:
 		fprintf(ef,
 			"%s table %s with foreign key constraint"
 			" failed. You have more than one on delete or on update clause"
-			" in %s close to %s.\n",
+			" in '%s' near '%s'.\n",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		mutex_exit(&dict_foreign_err_mutex);
 
 		ib_push_warning(trx, DB_CANNOT_ADD_CONSTRAINT,
 			"%s table %s with foreign key constraint"
 			" failed. You have more than one on delete or on update clause"
-			" in %s close to %s.",
+			" in '%s' near '%s'.",
 			operation, create_name, start_of_latest_foreign, start_of_latest_set);
 		dict_foreign_free(foreign);
 		return(DB_CANNOT_ADD_CONSTRAINT);
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 37a029d..f3b9167 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1035,6 +1035,19 @@ thd_supports_xa(
 }
 
 /******************************************************************//**
+Check the status of fake changes mode (innodb_fake_changes)
+ at return	true	if fake change mode is enabled. */
+extern "C" UNIV_INTERN
+ibool
+thd_fake_changes(
+/*=============*/
+	void*	thd)	/*!< in: thread handle, or NULL to query
+			the global innodb_supports_xa */
+{
+	return(THDVAR((THD*) thd, fake_changes));
+}
+
+/******************************************************************//**
 Returns the lock wait timeout for the current connection.
 @return	the lock wait timeout, in seconds */
 extern "C" UNIV_INTERN
@@ -1748,10 +1761,11 @@ innobase_next_autoinc(
 	if (next_value == 0) {
 		ulonglong	next;
 
-		if (current > offset) {
+		if (current >= offset) {
 			next = (current - offset) / step;
 		} else {
-			next = (offset - current) / step;
+			next = 0;
+			block -= step;
 		}
 
 		ut_a(max_value > next);
@@ -1799,7 +1813,15 @@ innobase_trx_init(
 	trx->check_unique_secondary = !thd_test_options(
 		thd, OPTION_RELAXED_UNIQUE_CHECKS);
 
-	trx->fake_changes = THDVAR(thd, fake_changes);
+	/* Transaction on start caches the fake_changes state and uses it for
+	complete transaction lifetime.
+	There are some APIs that doesn't need an active transaction object
+	but transaction object are just use as a cache object/data carrier.
+	Before using transaction object for such APIs refresh the state of
+	fake_changes. */
+	if (trx->state == TRX_NOT_STARTED) {
+		trx->fake_changes = thd_fake_changes(thd);
+	}
 
 #ifdef EXTENDED_SLOWLOG
 	if (thd_log_slow_verbosity(thd) & (1ULL << SLOG_V_INNODB)) {
@@ -3619,12 +3641,26 @@ innobase_commit(
 	/* No-op in XtraDB */
 	trx_search_latch_release_if_reserved(trx);
 
+	/* If fake-changes mode = ON then allow
+	SELECT (they are read-only) and
+	CREATE ... SELECT * from table (Well this doesn't open up DDL for InnoDB
+	as ha_innobase::create will return appropriate error if fake-change = ON
+	but if create is trying to use other SE and SELECT is executing on
+	InnoDB table then we allow SELECT to proceed.
+	Ideally, statement like this should be marked CREATE_SELECT like
+	INSERT_SELECT but unfortunately it doesn't). */
 	if (UNIV_UNLIKELY(trx->fake_changes
+			  && (thd_sql_command(thd) != SQLCOM_SELECT
+			      && thd_sql_command(thd) != SQLCOM_CREATE_TABLE)
 			  && (all || (!thd_test_options(thd,
 				OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))) {
 
-		innobase_rollback(hton, thd, all); /* rollback implicitly */
-		thd->stmt_da->reset_diagnostics_area(); /* because debug assertion code complains, if something left */
+		/* rollback implicitly */
+		innobase_rollback(hton, thd, all);
+
+		/* because debug assertion code complains, if something left */
+		thd->stmt_da->reset_diagnostics_area();
+
 		DBUG_RETURN(HA_ERR_WRONG_COMMAND);
 	}
 	/* Transaction is deregistered only in a commit or a rollback. If
@@ -4692,8 +4728,9 @@ ha_innobase::open(
 		DBUG_RETURN(1);
 	}
 
-	if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1)) {
 		free_share(share);
 
 		DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -4721,8 +4758,9 @@ ha_innobase::open(
 	/* Get pointer to a table object in InnoDB dictionary cache */
 	ib_table = dict_table_get(norm_name, TRUE, ignore_err);
 
-	if (UNIV_UNLIKELY(ib_table && ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(ib_table &&
+			 ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1)) {
 		free_share(share);
 		my_free(upd_buf);
 		upd_buf = NULL;
@@ -4775,8 +4813,9 @@ ha_innobase::open(
 				}
 
 				ib_table = dict_table_get(
-					par_case_name, FALSE, ignore_err);
+					par_case_name, TRUE, ignore_err);
 			}
+
 			if (ib_table) {
 #ifndef __WIN__
 				sql_print_warning("Partition table %s opened "
@@ -4798,6 +4837,10 @@ ha_innobase::open(
 						  "current file system\n",
 						  norm_name);
 #endif
+				/* We allow use of table if it is found.
+				this is consistent to current behavior
+				to innodb_plugin */
+				share->ib_table = ib_table;
 				goto table_opened;
 			}
 		}
@@ -6174,9 +6217,9 @@ ha_innobase::write_row(
 	DBUG_ENTER("ha_innobase::write_row");
 
 	if (prebuilt->trx != trx) {
-	  sql_print_error("The transaction object for the table handle is at "
-			  "%p, but for the current thread it is at %p",
-			  (const void*) prebuilt->trx, (const void*) trx);
+		sql_print_error("The transaction object for the table handle is at "
+			"%p, but for the current thread it is at %p",
+			(const void*) prebuilt->trx, (const void*) trx);
 
 		fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
 		ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
@@ -6190,7 +6233,7 @@ ha_innobase::write_row(
 
 	ha_statistic_increment(&SSV::ha_write_count);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -6416,7 +6459,7 @@ report_error:
 func_exit:
 	innobase_active_small();
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -6618,7 +6661,7 @@ ha_innobase::update_row(
 
 	ha_statistic_increment(&SSV::ha_update_count);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -6711,7 +6754,7 @@ ha_innobase::update_row(
 
 	innobase_active_small();
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -6736,7 +6779,7 @@ ha_innobase::delete_row(
 
 	ha_statistic_increment(&SSV::ha_delete_count);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -6768,7 +6811,7 @@ ha_innobase::delete_row(
 
 	innobase_active_small();
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7017,8 +7060,10 @@ ha_innobase::index_read(
 
 	ha_statistic_increment(&SSV::ha_read_key_count);
 
-	if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(!share->ib_table ||
+			(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1))) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7089,8 +7134,10 @@ ha_innobase::index_read(
 		ret = DB_UNSUPPORTED;
 	}
 
-	if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(!share->ib_table ||
+			(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1))) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7208,8 +7255,10 @@ ha_innobase::change_active_index(
 {
 	DBUG_ENTER("change_active_index");
 
-	if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(!share->ib_table ||
+			(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1))) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7332,8 +7381,10 @@ ha_innobase::general_fetch(
 		DBUG_RETURN(HA_ERR_END_OF_FILE);
 	}
 
-	if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(!share->ib_table ||
+			(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1))) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -7346,8 +7397,10 @@ ha_innobase::general_fetch(
 
 	innodb_srv_conc_exit_innodb(prebuilt->trx);
 
-	if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
-			  srv_pass_corrupt_table <= 1)) {
+	if (UNIV_UNLIKELY(!share->ib_table ||
+			(share->ib_table &&
+			 share->ib_table->is_corrupt &&
+			 srv_pass_corrupt_table <= 1))) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -8628,7 +8681,7 @@ ha_innobase::truncate(void)
 
 	update_thd(ha_thd());
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -8640,7 +8693,7 @@ ha_innobase::truncate(void)
 
 	error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -9365,7 +9418,8 @@ ha_innobase::info_low(
 	ib_table = prebuilt->table;
 
 	if (flag & HA_STATUS_TIME) {
-		if ((called_from_analyze || innobase_stats_on_metadata) && !share->ib_table->is_corrupt) {
+		if ((called_from_analyze || innobase_stats_on_metadata) &&
+		     share->ib_table && !share->ib_table->is_corrupt) {
 			/* In sql_show we call with this flag: update
 			then statistics so that they are up-to-date */
 
@@ -9719,7 +9773,7 @@ ha_innobase::analyze(
 	THD*		thd,		/*!< in: connection thread handle */
 	HA_CHECK_OPT*	check_opt)	/*!< in: currently ignored */
 {
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		return(HA_ADMIN_CORRUPT);
 	}
 
@@ -9727,7 +9781,7 @@ ha_innobase::analyze(
 	info_low(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE,
 		 true /* called from analyze */);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		return(HA_ADMIN_CORRUPT);
 	}
 
@@ -9980,7 +10034,7 @@ ha_innobase::check(
 		my_error(ER_QUERY_INTERRUPTED, MYF(0));
 	}
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		return(HA_ADMIN_CORRUPT);
 	}
 
@@ -10783,7 +10837,7 @@ ha_innobase::transactional_table_lock(
 
 	update_thd(thd);
 
-	if (share->ib_table->is_corrupt) {
+	if (!share->ib_table || share->ib_table->is_corrupt) {
 		DBUG_RETURN(HA_ERR_CRASHED);
 	}
 
@@ -11586,15 +11640,12 @@ ha_innobase::get_auto_increment(
 
 		current = *first_value;
 
-		/* If the increment step of the auto increment column
-		decreases then it is not affecting the immediate
-		next value in the series. */
-		if (prebuilt->autoinc_increment > increment) {
+		if (prebuilt->autoinc_increment != increment) {
 
 			current = autoinc - prebuilt->autoinc_increment;
 
 			current = innobase_next_autoinc(
-				current, 1, increment, 1, col_max_value);
+				current, 1, increment, offset, col_max_value);
 
 			dict_table_autoinc_initialize(prebuilt->table, current);
 
@@ -12698,6 +12749,46 @@ innodb_change_buffering_update(
 		 *static_cast<const char*const*>(save);
 }
 
+#ifdef UNIV_DEBUG
+/*************************************************************//**
+Check if it is a valid value of innodb_track_changed_pages.
+Changed pages tracking is not working correctly without initialization
+procedure on server startup. The function allows to temporary
+disable tracking, but only if the feature was enabled on startup.
+This function is registered as a callback with MySQL.
+ at return	0 for valid innodb_track_changed_pages */
+static
+int
+innodb_track_changed_pages_validate(
+	THD*				thd,	/*!< in: thread handle */
+	struct st_mysql_sys_var*	var,	/*!< in: pointer to system
+						variable */
+	void*				save,	/*!< out: immediate result
+						for update function */
+	struct st_mysql_value*		value)	/*!< in: incoming bool */
+{
+	static bool     enabled_on_startup = false;
+	long long	intbuf = 0;
+
+	if (value->val_int(value, &intbuf)) {
+		/* The value is NULL. That is invalid. */
+		return 1;
+	}
+
+	if (srv_track_changed_pages || enabled_on_startup) {
+		enabled_on_startup = true;
+		*reinterpret_cast<ulong*>(save)
+			= static_cast<ulong>(intbuf);
+		return 0;
+	}
+
+	if (intbuf == srv_track_changed_pages)
+		return 0;
+
+	return 1;
+}
+#endif
+
 #ifndef DBUG_OFF
 static char* srv_buffer_pool_evict;
 
@@ -13402,13 +13493,16 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method,
 /* Make this variable dynamic for debug builds to
 provide a testcase sync facility */
 #define track_changed_pages_flags PLUGIN_VAR_NOCMDARG
+#define track_changed_pages_check innodb_track_changed_pages_validate
 #else
 #define track_changed_pages_flags PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY
+#define track_changed_pages_check NULL
 #endif
 static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages,
   track_changed_pages_flags,
   "Track the redo log for changed pages and output a changed page bitmap",
-  NULL, NULL, FALSE);
+  track_changed_pages_check,
+  NULL, FALSE);
 
 static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size,
     PLUGIN_VAR_RQCMDARG,
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index bba0dad..c868fbb 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -6664,9 +6664,10 @@ i_s_innodb_buffer_pool_pages_blob_fill(
 		buf_pool = buf_pool_from_array(i);
 
 		buf_pool_mutex_enter(buf_pool);
-	
+
 		for (n_block = 0; n_block < buf_pool->curr_size; n_block++) {
 			buf_block_t*	block = buf_page_from_array(buf_pool, n_block);
+			mutex_t* block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
 			page_zip_des_t*	block_page_zip = buf_block_get_page_zip(block);
 			const buf_frame_t* frame = block->frame;
 
@@ -6676,16 +6677,16 @@ i_s_innodb_buffer_pool_pages_blob_fill(
 					part_len = 0; /* hmm, can't figure it out */
 
 					next_page_no = mach_read_from_4(
-							buf_block_get_frame(block)
-							+ FIL_PAGE_NEXT);        
+							frame
+							+ FIL_PAGE_NEXT);
 				} else {
 					part_len = mach_read_from_4(
-							buf_block_get_frame(block)
+							frame
 							+ FIL_PAGE_DATA
 							+ 0 /*BTR_BLOB_HDR_PART_LEN*/);
 
 					next_page_no = mach_read_from_4(
-							buf_block_get_frame(block)
+							frame
 							+ FIL_PAGE_DATA
 							+ 4 /*BTR_BLOB_HDR_NEXT_PAGE_NO*/);
 				}
@@ -6712,7 +6713,9 @@ i_s_innodb_buffer_pool_pages_blob_fill(
 				}
 
 			}
-		}      
+
+			mutex_exit(block_mutex);
+		}
 
 		buf_pool_mutex_exit(buf_pool);
 	}
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index ad0abb8..c127e63 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -276,6 +276,16 @@ thd_supports_xa(
 			the global innodb_supports_xa */
 
 /******************************************************************//**
+Check the status of fake changes mode (innodb_fake_changes)
+ at return	true	if fake change mode is enabled. */
+
+ibool
+thd_fake_changes(
+/*=============*/
+	void*	thd);	/*!< in: thread handle, or NULL to query
+			the global innodb_supports_xa */
+
+/******************************************************************//**
 Returns the lock wait timeout for the current connection.
 @return	the lock wait timeout, in seconds */
 
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index a7b74c8..71da5ea 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -119,6 +119,10 @@ log. */
 #define OS_FILE_READ_ONLY		333
 #define	OS_FILE_READ_WRITE		444
 #define	OS_FILE_READ_ALLOW_DELETE	555	/* for ibbackup */
+#define OS_FILE_READ_WRITE_CACHED	666	/* OS_FILE_READ_WRITE but never
+					O_DIRECT. Only for
+					os_file_create_simple_no_error_handling
+				        currently. */
 
 /* Options for file_create */
 #define	OS_FILE_AIO			61
@@ -505,9 +509,10 @@ os_file_create_simple_no_error_handling_func(
 				OS_FILE_CREATE if a new file is created
 				(if exists, error) */
 	ulint		access_type,/*!< in: OS_FILE_READ_ONLY,
-				OS_FILE_READ_WRITE, or
-				OS_FILE_READ_ALLOW_DELETE; the last option is
-				used by a backup program reading the file */
+				OS_FILE_READ_WRITE, OS_FILE_READ_ALLOW_DELETE
+				(used by a backup program reading the file), or
+				OS_FILE_READ_WRITE_CACHED (disable O_DIRECT if
+				it would be enabled otherwise). */
 	ibool*		success);/*!< out: TRUE if succeed, FALSE if error */
 /****************************************************************//**
 Tries to disable OS caching on an opened file descriptor. */
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index d9f2407..a60dcbd 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, Google Inc.
 
 Portions of this file contain modifications contributed and copyrighted by
@@ -37,6 +37,21 @@ Created 9/6/1995 Heikki Tuuri
 #include "univ.i"
 #include "ut0lst.h"
 
+#if defined __i386__ || defined __x86_64__ || defined _M_IX86 \
+    || defined _M_X64 || defined __WIN__
+
+#define IB_STRONG_MEMORY_MODEL
+#undef HAVE_IB_GCC_ATOMIC_TEST_AND_SET // Quick-and-dirty fix for bug 1519094
+
+#endif /* __i386__ || __x86_64__ || _M_IX86 || M_X64 || __WIN__ */
+
+#ifdef HAVE_WINDOWS_ATOMICS
+typedef LONG lock_word_t;	/*!< On Windows, InterlockedExchange operates
+				on LONG variable */
+#else
+typedef byte lock_word_t;
+#endif
+
 #ifdef __WIN__
 /** Native event (slow)*/
 typedef HANDLE			os_native_event_t;
@@ -354,6 +369,62 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
 # define os_atomic_test_and_set_byte_acquire(ptr, new_val) \
 	__sync_lock_test_and_set(ptr, (byte) new_val)
 
+# if defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
+
+/** Do an atomic test-and-set.
+ at param[in,out]	ptr		Memory location to set to non-zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_test_and_set(volatile lock_word_t* ptr)
+{
+       return(__atomic_test_and_set(ptr, __ATOMIC_ACQUIRE));
+}
+
+/** Do an atomic clear.
+ at param[in,out]	ptr		Memory location to set to zero */
+static inline
+void
+os_atomic_clear(volatile lock_word_t* ptr)
+{
+	__atomic_clear(ptr, __ATOMIC_RELEASE);
+}
+
+# elif defined(IB_STRONG_MEMORY_MODEL)
+
+/** Do an atomic test and set.
+ at param[in,out]	ptr		Memory location to set to non-zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_test_and_set(volatile lock_word_t* ptr)
+{
+	return(__sync_lock_test_and_set(ptr, 1));
+}
+
+/** Do an atomic release.
+
+In theory __sync_lock_release should be used to release the lock.
+Unfortunately, it does not work properly alone. The workaround is
+that more conservative __sync_lock_test_and_set is used instead.
+
+Performance regression was observed at some conditions for Intel
+architecture. Disable release barrier on Intel architecture for now.
+ at param[in,out]	ptr		Memory location to write to
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_clear(volatile lock_word_t* ptr)
+{
+	return(__sync_lock_test_and_set(ptr, 0));
+}
+
+# else
+
+#  error "Unsupported platform"
+
+# endif /* HAVE_IB_GCC_ATOMIC_TEST_AND_SET */
+
 #elif defined(HAVE_IB_SOLARIS_ATOMICS)
 
 # define HAVE_ATOMIC_BUILTINS
@@ -413,6 +484,26 @@ Returns the old value of *ptr, atomically sets *ptr to new_val */
 # define os_atomic_test_and_set_byte_release(ptr, new_val) \
 	atomic_swap_uchar(ptr, new_val)
 
+/** Do an atomic xchg and set to non-zero.
+ at param[in,out]	ptr		Memory location to set to non-zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_test_and_set(volatile lock_word_t* ptr)
+{
+	return(atomic_swap_uchar(ptr, 1));
+}
+
+/** Do an atomic xchg and set to zero.
+ at param[in,out]	ptr		Memory location to set to zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_clear(volatile lock_word_t* ptr)
+{
+	return(atomic_swap_uchar(ptr, 0));
+}
+
 #elif defined(HAVE_WINDOWS_ATOMICS)
 
 # define HAVE_ATOMIC_BUILTINS
@@ -472,6 +563,28 @@ clobbered */
 # define os_atomic_test_and_set_byte_release(ptr, new_val) \
 	((byte) InterlockedExchange(ptr, new_val))
 
+/** Do an atomic test and set.
+InterlockedExchange() operates on LONG, and the LONG will be clobbered
+ at param[in,out]	ptr		Memory location to set to non-zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_test_and_set(volatile lock_word_t* ptr)
+{
+	return(InterlockedExchange(ptr, 1));
+}
+
+/** Do an atomic release.
+InterlockedExchange() operates on LONG, and the LONG will be clobbered
+ at param[in,out]	ptr		Memory location to set to zero
+ at return the previous value */
+static inline
+lock_word_t
+os_atomic_clear(volatile lock_word_t* ptr)
+{
+	return(InterlockedExchange(ptr, 0));
+}
+
 #else
 # define IB_ATOMICS_STARTUP_MSG \
 	"Mutexes and rw_locks use InnoDB's own implementation"
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index 8509058..7568690 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, Google Inc.
 
 Portions of this file contain modifications contributed and copyrighted by
@@ -45,13 +45,6 @@ Created 9/5/1995 Heikki Tuuri
 extern my_bool	timed_mutexes;
 #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
 
-#ifdef _WIN32
-typedef LONG lock_word_t;	/*!< On Windows, InterlockedExchange operates
-				on LONG variable */
-#else
-typedef byte lock_word_t;
-#endif
-
 #if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
 /* There are mutexes/rwlocks that we want to exclude from
 instrumentation even if their corresponding performance schema
diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic
index fee9735..48039c8 100644
--- a/storage/xtradb/include/sync0sync.ic
+++ b/storage/xtradb/include/sync0sync.ic
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
 Copyright (c) 2008, Google Inc.
 
 Portions of this file contain modifications contributed and copyrighted by
@@ -80,7 +80,7 @@ mutex_test_and_set(
 	mutex_t*	mutex)	/*!< in: mutex */
 {
 #if defined(HAVE_ATOMIC_BUILTINS)
-	return(os_atomic_test_and_set_byte_acquire(&mutex->lock_word, 1));
+	return(os_atomic_test_and_set(&mutex->lock_word));
 #else
 	ibool	ret;
 
@@ -108,10 +108,7 @@ mutex_reset_lock_word(
 	mutex_t*	mutex)	/*!< in: mutex */
 {
 #if defined(HAVE_ATOMIC_BUILTINS)
-	/* In theory __sync_lock_release should be used to release the lock.
-	Unfortunately, it does not work properly alone. The workaround is
-	that more conservative __sync_lock_test_and_set is used instead. */
-	os_atomic_test_and_set_byte_release(&mutex->lock_word, 0);
+	os_atomic_clear(&mutex->lock_word);
 #else
 	mutex->lock_word = 0;
 
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 7c19ceb..6e130b1 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -64,10 +64,10 @@ component, i.e. we show M.N.P as M.N */
 	(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
 
 #ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 37.4
+#define PERCONA_INNODB_VERSION 37.6
 #endif
 
-#define INNODB_VERSION_STR	"5.5.45-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
+#define INNODB_VERSION_STR	"5.5.46-MariaDB-" IB_TO_STR(PERCONA_INNODB_VERSION)
 
 #define REFMAN "http://dev.mysql.com/doc/refman/"	\
 	IB_TO_STR(MYSQL_MAJOR_VERSION) "."		\
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index 9d0151f..4d7587a 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -2467,16 +2467,16 @@ lock_rec_inherit_to_gap(
 	/* If srv_locks_unsafe_for_binlog is TRUE or session is using
 	READ COMMITTED isolation level, we do not want locks set
 	by an UPDATE or a DELETE to be inherited as gap type locks. But we
-	DO want S-locks set by a consistency constraint to be inherited also
-	then. */
+	DO want S-locks/X-locks (taken for replace) set by a consistency
+	constraint to be inherited also then. */
 
 	while (lock != NULL) {
 		if (!lock_rec_get_insert_intention(lock)
 		    && !((srv_locks_unsafe_for_binlog
 			  || lock->trx->isolation_level
 			  <= TRX_ISO_READ_COMMITTED)
-			 && lock_get_mode(lock) == LOCK_X)) {
-
+			 && lock_get_mode(lock) ==
+			 (lock->trx->duplicates ? LOCK_S : LOCK_X))) {
 			lock_rec_add_to_queue(LOCK_REC | LOCK_GAP
 					      | lock_get_mode(lock),
 					      heir_block, heir_heap_no,
diff --git a/storage/xtradb/log/log0online.c b/storage/xtradb/log/log0online.c
index acb3bd5..a844419 100644
--- a/storage/xtradb/log/log0online.c
+++ b/storage/xtradb/log/log0online.c
@@ -544,7 +544,7 @@ log_online_start_bitmap_file(void)
 							innodb_file_bmp_key,
 							log_bmp_sys->out.name,
 							OS_FILE_CREATE,
-							OS_FILE_READ_WRITE,
+							OS_FILE_READ_WRITE_CACHED,
 							&success);
 	}
 	if (UNIV_UNLIKELY(!success)) {
@@ -704,7 +704,7 @@ log_online_read_init(void)
 	log_bmp_sys->out.file
 		= os_file_create_simple_no_error_handling
 		(innodb_file_bmp_key, log_bmp_sys->out.name, OS_FILE_OPEN,
-		 OS_FILE_READ_WRITE, &success);
+		 OS_FILE_READ_WRITE_CACHED, &success);
 
 	if (!success) {
 
@@ -1494,10 +1494,20 @@ log_online_open_bitmap_file_read_only(
 	ibool	success	= FALSE;
 	ulint	size_low;
 	ulint	size_high;
+	size_t  srv_data_home_len;
 
 	ut_ad(name[0] != '\0');
 
-	ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
+	srv_data_home_len = strlen(srv_data_home);
+	if (srv_data_home_len
+			&& srv_data_home[srv_data_home_len-1]
+			!= SRV_PATH_SEPARATOR) {
+		ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%c%s",
+				srv_data_home, SRV_PATH_SEPARATOR, name);
+	} else {
+		ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s",
+				srv_data_home, name);
+	}
 	bitmap_file->file
 		= os_file_create_simple_no_error_handling(innodb_file_bmp_key,
 							  bitmap_file->name,
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index cae3642..e465f9a 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -1840,7 +1840,7 @@ loop:
 		goto loop;
 	}
 
-	ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
+	ut_ad((allow_ibuf == 0) == (mutex_own(&log_sys->mutex) != 0));
 
 	if (!allow_ibuf) {
 		recv_no_ibuf_operations = TRUE;
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 3cec27f..8870f82 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -1319,9 +1319,10 @@ os_file_create_simple_no_error_handling_func(
 				OS_FILE_CREATE if a new file is created
 				(if exists, error) */
 	ulint		access_type,/*!< in: OS_FILE_READ_ONLY,
-				OS_FILE_READ_WRITE, or
-				OS_FILE_READ_ALLOW_DELETE; the last option is
-				used by a backup program reading the file */
+				OS_FILE_READ_WRITE, OS_FILE_READ_ALLOW_DELETE
+				(used by a backup program reading the file), or
+				OS_FILE_READ_WRITE_CACHED (disable O_DIRECT if
+				it would be enabled otherwise). */
 	ibool*		success)/*!< out: TRUE if succeed, FALSE if error */
 {
 #ifdef __WIN__
@@ -1344,7 +1345,8 @@ os_file_create_simple_no_error_handling_func(
 
 	if (access_type == OS_FILE_READ_ONLY) {
 		access = GENERIC_READ;
-	} else if (access_type == OS_FILE_READ_WRITE) {
+	} else if (access_type == OS_FILE_READ_WRITE
+		   || access_type == OS_FILE_READ_WRITE_CACHED) {
 		access = GENERIC_READ | GENERIC_WRITE;
 	} else if (access_type == OS_FILE_READ_ALLOW_DELETE) {
 		access = GENERIC_READ;
@@ -1405,7 +1407,8 @@ os_file_create_simple_no_error_handling_func(
 	if (file == -1) {
 		*success = FALSE;
 #ifdef USE_FILE_LOCK
-	} else if (access_type == OS_FILE_READ_WRITE
+	} else if ((access_type == OS_FILE_READ_WRITE
+		    || access_type == OS_FILE_READ_WRITE_CACHED)
 		   && os_file_lock(file, name)) {
 		*success = FALSE;
 		close(file);
@@ -1418,7 +1421,9 @@ os_file_create_simple_no_error_handling_func(
 		disable OS caching (O_DIRECT) here as we do in
 		os_file_create_func(), so we open the same file in the same
 		mode, see man page of open(2). */
-		if (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
+		if ((srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
+		    || srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT)
+		    && access_type != OS_FILE_READ_WRITE_CACHED) {
 			os_file_set_nocache(file, name, mode_str);
 		}
 	}
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index 97a4fb0..6de9a95 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -247,8 +247,9 @@ row_ins_sec_index_entry_by_modify(
 	rec = btr_cur_get_rec(cursor);
 
 	ut_ad(!dict_index_is_clust(cursor->index));
-	ut_ad(rec_get_deleted_flag(rec,
-				   dict_table_is_comp(cursor->index->table)));
+	ut_ad(UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)
+	      || rec_get_deleted_flag(rec,
+			dict_table_is_comp(cursor->index->table)));
 
 	/* We know that in the alphabetical ordering, entry and rec are
 	identified. But in their binary form there may be differences if
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index 11b0de4..17cb837 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -880,6 +880,12 @@ trx_start_low(
 
 	trx->no = IB_ULONGLONG_MAX;
 
+	/* Cache the state of fake_changes that transaction will use for
+	lifetime. Any change in session/global fake_changes configuration during
+	lifetime of transaction will not be honored by already started
+	transaction. */
+	trx->fake_changes = thd_fake_changes(trx->mysql_thd);
+
 	trx->rseg = rseg;
 
 	trx->state = TRX_ACTIVE;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index edcac27..2dd7f5e 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -4585,7 +4585,7 @@ my_wc_mb_filename(CHARSET_INFO *cs __attribute__((unused)),
   }
 
   /* Non letter */
-  if (s + 5 > e)
+  if (s + 4 > e)
     return MY_CS_TOOSMALL5;
 
   *s++= hex[(wc >> 12) & 15];
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index e23b837..63cef2a 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -210,7 +210,7 @@ else
   fi
 fi
 
-parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
+parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server`
 
 # wait for the pid file to disappear
 wait_for_gone () {
diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt
index effdd9b..c4af782 100644
--- a/unittest/mysys/CMakeLists.txt
+++ b/unittest/mysys/CMakeLists.txt
@@ -14,6 +14,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 MY_ADD_TESTS(bitmap base64 my_vsnprintf my_atomic my_rdtsc lf my_malloc
+             my_getopt
              LINK_LIBRARIES mysys)
 
 IF(WIN32)
diff --git a/unittest/mysys/my_getopt-t.c b/unittest/mysys/my_getopt-t.c
new file mode 100644
index 0000000..afdb5e8
--- /dev/null
+++ b/unittest/mysys/my_getopt-t.c
@@ -0,0 +1,71 @@
+/* Copyright (C) 2015 MariaDB
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
+
+#include <tap.h>
+#include <my_getopt.h>
+#include <stdarg.h>
+
+ulonglong opt_ull;
+ulong opt_ul;
+int argc, res;
+char **argv, *args[100];
+
+struct my_option my_long_options[]=
+{
+  {"ull", 0, "ull", &opt_ull, &opt_ull,
+   0, GET_ULL, REQUIRED_ARG, 1, 0, ~0ULL, 0, 0, 0},
+  {"ul", 0, "ul", &opt_ul, &opt_ul,
+   0, GET_ULONG, REQUIRED_ARG, 1, 0, 0xFFFFFFFF, 0, 0, 0},
+  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
+};
+
+void run(const char *arg, ...)
+{
+  va_list ap;
+  va_start(ap, arg);
+  argv= args;
+  *argv++= (char*)"<skipped>";
+  while (arg)
+  {
+    *argv++= (char*)arg;
+    arg= va_arg(ap, char*);
+  }
+  va_end(ap);
+  argc= argv - args;
+  argv= args;
+  res= handle_options(&argc, &argv, my_long_options, 0);
+}
+
+int main() {
+  plan(3);
+
+  run("--ull=100", NULL);
+  ok(res==0 && argc==0 && opt_ull==100,
+     "res:%d, argc:%d, opt_ull:%llu", res, argc, opt_ull);
+
+  /*
+    negative numbers are wrapped. this is kinda questionable,
+    we might want to fix it eventually. but it'd be a change in behavior,
+    users might've got used to "-1" meaning "max possible value"
+  */
+  run("--ull=-100", NULL);
+  ok(res==0 && argc==0 && opt_ull==18446744073709551516ULL,
+     "res:%d, argc:%d, opt_ull:%llu", res, argc, opt_ull);
+  run("--ul=-100", NULL);
+  ok(res==0 && argc==0 && opt_ul==4294967295UL,
+     "res:%d, argc:%d, opt_ul:%lu", res, argc, opt_ul);
+  return exit_status();
+}
+

-- 
Alioth's hooks/post-receive on /srv/git.debian.org/git/pkg-mysql/mariadb-5.5.git



More information about the Pkg-mysql-commits mailing list