List:Commits« Previous MessageNext Message »
From:Lars Thalmann Date:September 15 2006 1:47am
Subject:bk commit into 5.1 tree (lars:1.2315)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of lthalmann. When lthalmann does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-09-15 01:46:47+02:00, lars@stripped +16 -0
  Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-new-rpl
  into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.1-merge
  MERGE: 1.2309.1.15

  client/mysqldump.c@stripped, 2006-09-15 01:46:33+02:00, lars@stripped +0 -1
    Merge main->rpl
    MERGE: 1.245.1.1

  mysql-test/r/mysqldump.result@stripped, 2006-09-15 01:32:34+02:00, lars@stripped +0
-0
    Auto merged
    MERGE: 1.121.1.1

  mysql-test/r/variables.result@stripped, 2006-09-15 01:46:33+02:00, lars@stripped +0
-6
    Merge main->rpl
    MERGE: 1.88.1.1

  mysql-test/t/disabled.def@stripped, 2006-09-15 01:46:33+02:00, lars@stripped +2 -2
    Merge main->rpl
    MERGE: 1.194.2.1

  mysql-test/t/mysqldump.test@stripped, 2006-09-15 01:46:34+02:00, lars@stripped +14
-15
    Merge main->rpl
    MERGE: 1.115.1.1

  mysql-test/t/variables.test@stripped, 2006-09-15 01:32:34+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.61.1.1

  sql/field.cc@stripped, 2006-09-15 01:32:34+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.339.1.1

  sql/log.cc@stripped, 2006-09-15 01:32:35+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.225.2.2

  sql/mysql_priv.h@stripped, 2006-09-15 01:32:35+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.433.1.1

  sql/mysqld.cc@stripped, 2006-09-15 01:32:35+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.574.5.1

  sql/sql_class.cc@stripped, 2006-09-15 01:32:36+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.287.1.2

  sql/sql_insert.cc@stripped, 2006-09-15 01:32:36+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.221.1.2

  sql/sql_parse.cc@stripped, 2006-09-15 01:32:36+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.582.1.1

  sql/sql_show.cc@stripped, 2006-09-15 01:32:37+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.365.2.2

  sql/sql_yacc.yy@stripped, 2006-09-15 01:32:37+02:00, lars@stripped +0 -0
    Auto merged
    MERGE: 1.496.1.2

  storage/innobase/handler/ha_innodb.cc@stripped, 2006-09-15 01:32:38+02:00,
lars@stripped +0 -3
    Auto merged
    MERGE: 1.284.4.6

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	lars
# Host:	dl145j.mysql.com
# Root:	/users/lthalmann/bk/MERGE/mysql-5.1-merge/RESYNC

--- 1.248/client/mysqldump.c	2006-09-15 01:47:13 +02:00
+++ 1.249/client/mysqldump.c	2006-09-15 01:47:13 +02:00
@@ -665,13 +665,13 @@ get_one_option(int optid, const struct m
       tty_password=1;
     break;
   case 'r':
-    if (!(md_result_file = my_fopen(argument, O_WRONLY | FILE_BINARY,
+    if (!(md_result_file= my_fopen(argument, O_WRONLY | FILE_BINARY,
                                     MYF(MY_WME))))
       exit(1);
     break;
   case 'W':
 #ifdef __WIN__
-    opt_protocol = MYSQL_PROTOCOL_PIPE;
+    opt_protocol= MYSQL_PROTOCOL_PIPE;
 #endif
     break;
   case 'N':
@@ -686,7 +686,7 @@ get_one_option(int optid, const struct m
 #include <sslopt-case.h>
   case 'V': print_version(); exit(0);
   case 'X':
-    opt_xml = 1;
+    opt_xml= 1;
     extended_insert= opt_drop= opt_lock=
       opt_disable_keys= opt_autocommit= opt_create_db= 0;
     break;
@@ -1576,7 +1576,7 @@ static uint get_table_structure(char *ta
   const char *insert_option;
   char	     name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
   char       table_buff2[NAME_LEN*2+3], query_buff[QUERY_LENGTH];
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   int        len;
   MYSQL_RES  *result;
   MYSQL_ROW  row;
@@ -1620,7 +1620,7 @@ static uint get_table_structure(char *ta
   opt_quoted_table= quote_name(table, table_buff2, 0);
 
   if (opt_order_by_primary)
-    order_by = primary_key_fields(result_table);
+    order_by= primary_key_fields(result_table);
 
   if (!opt_xml && !mysql_query_with_error_report(mysql, 0, query_buff))
   {
@@ -1672,7 +1672,7 @@ static uint get_table_structure(char *ta
       field= mysql_fetch_field_direct(result, 0);
       if (strcmp(field->name, "View") == 0)
       {
-        char *scv_buff = NULL;
+        char *scv_buff= NULL;
 
         verbose_msg("-- It's a view, create dummy table for view\n");
 
@@ -1709,7 +1709,7 @@ static uint get_table_structure(char *ta
           my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
 
           safe_exit(EX_MYSQLERR);
-          DBUG_RETURN(0); 
+          DBUG_RETURN(0);
         }
         else
           my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
@@ -2079,7 +2079,7 @@ static void dump_triggers_for_table (cha
   char       name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
   char       query_buff[QUERY_LENGTH];
   uint old_opt_compatible_mode=opt_compatible_mode;
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   MYSQL_RES  *result;
   MYSQL_ROW  row;
 
@@ -2323,15 +2323,15 @@ static void dump_table(char *table, char
     end= strmov(end,buff);
     if (where || order_by)
     {
-      query = alloc_query_str((ulong) ((end - query) + 1 +
+      query= alloc_query_str((ulong) ((end - query) + 1 +
                              (where ? strlen(where) + 7 : 0) +
                              (order_by ? strlen(order_by) + 10 : 0)));
-      end = strmov(query, query_buf);
+      end= strmov(query, query_buf);
 
       if (where)
-        end = strxmov(end, " WHERE ", where, NullS);
+        end= strxmov(end, " WHERE ", where, NullS);
       if (order_by)
-        end = strxmov(end, " ORDER BY ", order_by, NullS);
+        end= strxmov(end, " ORDER BY ", order_by, NullS);
     }
     if (mysql_real_query(mysql, query, (uint) (end - query)))
     {
@@ -2352,10 +2352,10 @@ static void dump_table(char *table, char
                 result_table);
     if (where || order_by)
     {
-      query = alloc_query_str((ulong) (strlen(query) + 1 +
+      query= alloc_query_str((ulong) (strlen(query) + 1 +
                              (where ? strlen(where) + 7 : 0) +
                              (order_by ? strlen(order_by) + 10 : 0)));
-      end = strmov(query, query_buf);
+      end= strmov(query, query_buf);
 
       if (where)
       {
@@ -2364,7 +2364,7 @@ static void dump_table(char *table, char
           fprintf(md_result_file, "-- WHERE:  %s\n", where);
           check_io(md_result_file);
         }
-        end = strxmov(end, " WHERE ", where, NullS);
+        end= strxmov(end, " WHERE ", where, NullS);
       }
       if (order_by)
       {
@@ -2373,7 +2373,7 @@ static void dump_table(char *table, char
           fprintf(md_result_file, "-- ORDER BY:  %s\n", order_by);
           check_io(md_result_file);
         }
-        end = strxmov(end, " ORDER BY ", order_by, NullS);
+        end= strxmov(end, " ORDER BY ", order_by, NullS);
       }
     }
     if (!opt_xml && !opt_compact)
@@ -2449,12 +2449,12 @@ static void dump_table(char *table, char
         check_io(md_result_file);
       }
 
-      for (i = 0; i < mysql_num_fields(res); i++)
+      for (i= 0; i < mysql_num_fields(res); i++)
       {
         int is_blob;
         ulong length= lengths[i];
 
-        if (!(field = mysql_fetch_field(res)))
+        if (!(field= mysql_fetch_field(res)))
         {
           my_snprintf(query, QUERY_LENGTH,
                       "%s: Not enough fields from table %s! Aborting.\n",
@@ -2526,7 +2526,7 @@ static void dump_table(char *table, char
               else
               {
                 /* change any strings ("inf", "-inf", "nan") into NULL */
-                char *ptr = row[i];
+                char *ptr= row[i];
                 if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
                     my_isalpha(charset_info, ptr[1])))
                   dynstr_append(&extended_row, "NULL");
@@ -2586,7 +2586,7 @@ static void dump_table(char *table, char
             else
             {
               /* change any strings ("inf", "-inf", "nan") into NULL */
-              char *ptr = row[i];
+              char *ptr= row[i];
               if (opt_xml)
               {
                 print_xml_tag1(md_result_file, "\t\t", "field name=",
@@ -2632,10 +2632,10 @@ static void dump_table(char *table, char
       {
         ulong row_length;
         dynstr_append(&extended_row,")");
-        row_length = 2 + extended_row.length;
+        row_length= 2 + extended_row.length;
         if (total_length + row_length < opt_net_buffer_length)
         {
-          total_length += row_length;
+          total_length+= row_length;
           fputc(',',md_result_file);            /* Always row break */
           fputs(extended_row.str,md_result_file);
         }
@@ -2647,7 +2647,7 @@ static void dump_table(char *table, char
 
           fputs(insert_pat.str,md_result_file);
           fputs(extended_row.str,md_result_file);
-          total_length = row_length+init_length;
+          total_length= row_length+init_length;
         }
         check_io(md_result_file);
       }
@@ -2712,15 +2712,15 @@ err:
 
 static char *getTableName(int reset)
 {
-  static MYSQL_RES *res = NULL;
+  static MYSQL_RES *res= NULL;
   MYSQL_ROW    row;
 
   if (!res)
   {
-    if (!(res = mysql_list_tables(mysql,NullS)))
+    if (!(res= mysql_list_tables(mysql,NullS)))
       return(NULL);
   }
-  if ((row = mysql_fetch_row(res)))
+  if ((row= mysql_fetch_row(res)))
     return((char*) row[0]);
 
   if (reset)
@@ -2728,7 +2728,7 @@ static char *getTableName(int reset)
   else
   {
     mysql_free_result(res);
-    res = NULL;
+    res= NULL;
   }
   return(NULL);
 } /* getTableName */
@@ -2866,7 +2866,7 @@ static int dump_all_databases()
 
   if (mysql_query_with_error_report(mysql, &tableres, "SHOW DATABASES"))
     return 1;
-  while ((row = mysql_fetch_row(tableres)))
+  while ((row= mysql_fetch_row(tableres)))
   {
     if (dump_all_tables_in_db(row[0]))
       result=1;
@@ -2874,13 +2874,13 @@ static int dump_all_databases()
   if (seen_views)
   {
     if (mysql_query(mysql, "SHOW DATABASES") ||
-        !(tableres = mysql_store_result(mysql)))
+        !(tableres= mysql_store_result(mysql)))
     {
       my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s",
                       MYF(0), mysql_error(mysql));
       return 1;
     }
-    while ((row = mysql_fetch_row(tableres)))
+    while ((row= mysql_fetch_row(tableres)))
     {
       if (dump_all_views_in_db(row[0]))
         result=1;
@@ -3320,7 +3320,7 @@ static int do_show_master_status(MYSQL *
   }
   else
   {
-    row = mysql_fetch_row(master);
+    row= mysql_fetch_row(master);
     if (row && row[0] && row[1])
     {
       /* SHOW MASTER STATUS reports file and position */
@@ -3447,7 +3447,7 @@ static void print_value(FILE *file, MYSQ
   MYSQL_FIELD   *field;
   mysql_field_seek(result, 0);
 
-  for ( ; (field = mysql_fetch_field(result)) ; row++)
+  for ( ; (field= mysql_fetch_field(result)) ; row++)
   {
     if (!strcmp(field->name,name))
     {
@@ -3575,17 +3575,19 @@ char check_if_ignore_table(const char *t
 
 static char *primary_key_fields(const char *table_name)
 {
-  MYSQL_RES  *res = NULL;
+  MYSQL_RES  *res= NULL;
   MYSQL_ROW  row;
   /* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
   char show_keys_buff[15 + NAME_LEN * 2 + 3];
-  uint result_length = 0;
-  char *result = 0;
+  uint result_length= 0;
+  char *result= 0;
+  char buff[NAME_LEN * 2 + 3];
+  char *quoted_field;
 
   my_snprintf(show_keys_buff, sizeof(show_keys_buff),
               "SHOW KEYS FROM %s", table_name);
   if (mysql_query(mysql, show_keys_buff) ||
-      !(res = mysql_store_result(mysql)))
+      !(res= mysql_store_result(mysql)))
   {
     fprintf(stderr, "Warning: Couldn't read keys from table %s;"
             " records are NOT sorted (%s)\n",
@@ -3600,12 +3602,14 @@ static char *primary_key_fields(const ch
    * row, and UNIQUE keys come before others.  So we only need to check
    * the first key, not all keys.
    */
-  if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0)
+  if ((row= mysql_fetch_row(res)) && atoi(row[1]) == 0)
   {
     /* Key is unique */
     do
-      result_length += strlen(row[4]) + 1;      /* + 1 for ',' or \0 */
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1);
+    {
+      quoted_field= quote_name(row[4], buff, 0);
+      result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
+    } while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
   }
 
   /* Build the ORDER BY clause result */
@@ -3613,17 +3617,21 @@ static char *primary_key_fields(const ch
   {
     char *end;
     /* result (terminating \0 is already in result_length) */
-    result = my_malloc(result_length + 10, MYF(MY_WME));
+    result= my_malloc(result_length + 10, MYF(MY_WME));
     if (!result)
     {
       fprintf(stderr, "Error: Not enough memory to store ORDER BY clause\n");
       goto cleanup;
     }
     mysql_data_seek(res, 0);
-    row = mysql_fetch_row(res);
-    end = strmov(result, row[4]);
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1)
-      end = strxmov(end, ",", row[4], NullS);
+    row= mysql_fetch_row(res);
+    quoted_field= quote_name(row[4], buff, 0);
+    end= strmov(result, quoted_field);
+    while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1)
+    {
+      quoted_field= quote_name(row[4], buff, 0);
+      end= strxmov(end, ",", quoted_field, NullS);
+    }
   }
 
 cleanup:
@@ -3691,7 +3699,7 @@ static my_bool get_view_structure(char *
   char       table_buff[NAME_LEN*2+3];
   char       table_buff2[NAME_LEN*2+3];
   char       query[QUERY_LENGTH];
-  FILE       *sql_file = md_result_file;
+  FILE       *sql_file= md_result_file;
   DBUG_ENTER("get_view_structure");
 
   if (opt_no_create_info) /* Don't write table creation info */

--- 1.340/sql/field.cc	2006-09-15 01:47:13 +02:00
+++ 1.341/sql/field.cc	2006-09-15 01:47:13 +02:00
@@ -1257,6 +1257,13 @@ void Field::hash(ulong *nr, ulong *nr2)
   }
 }
 
+my_size_t
+Field::do_last_null_byte() const
+{
+  DBUG_ASSERT(null_ptr == NULL || (byte*) null_ptr >= table->record[0]);
+  return null_ptr ? (byte*) null_ptr - table->record[0] + 1 : 0;
+}
+
 
 void Field::copy_from_tmp(int row_offset)
 {
@@ -8094,6 +8101,30 @@ Field_bit::Field_bit(char *ptr_arg, uint
 }
 
 
+my_size_t
+Field_bit::do_last_null_byte() const
+{
+  /*
+    Code elsewhere is assuming that bytes are 8 bits, so I'm using
+    that value instead of the correct one: CHAR_BIT.
+
+    REFACTOR SUGGESTION (Matz): Change to use the correct number of
+    bits. On systems with CHAR_BIT > 8 (not very common), the storage
+    will lose the extra bits.
+  */
+  DBUG_PRINT("debug", ("bit_ofs=%d, bit_len=%d, bit_ptr=%p",
+                       bit_ofs, bit_len, bit_ptr));
+  uchar *result;
+  if (bit_len == 0)
+    result= null_ptr;
+  else if (bit_ofs + bit_len > 8)
+    result= bit_ptr + 1;
+  else
+    result= bit_ptr;
+
+  return result ? (byte*) result - table->record[0] + 1 : 0;
+}
+
 Field *Field_bit::new_key_field(MEM_ROOT *root,
                                 struct st_table *new_table,
                                 char *new_ptr, uchar *new_null_ptr,
@@ -8344,6 +8375,14 @@ const char *Field_bit::unpack(char *to, 
   return from + bytes_in_rec;
 }
 
+
+void Field_bit::set_default()
+{
+  my_ptrdiff_t const offset= table->s->default_values - table->record[0];
+  uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len);
+  set_rec_bits(bits, bit_ptr, bit_ofs, bit_len);
+  Field::set_default();
+}
 
 /*
   Bit field support for non-MyISAM tables.

--- 1.228/sql/log.cc	2006-09-15 01:47:13 +02:00
+++ 1.229/sql/log.cc	2006-09-15 01:47:13 +02:00
@@ -3171,7 +3171,7 @@ int MYSQL_BIN_LOG::
   flush_and_set_pending_rows_event(THD *thd, Rows_log_event* event)
 {
   DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)");
-  DBUG_ASSERT(thd->current_stmt_binlog_row_based && mysql_bin_log.is_open());
+  DBUG_ASSERT(mysql_bin_log.is_open());
   DBUG_PRINT("enter", ("event=%p", event));
 
   int error= 0;
@@ -3416,9 +3416,6 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
           }
         }
       }
-      /* Forget those values, for next binlogger: */
-      thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
-      thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty();
     }
 
     /*

--- 1.436/sql/mysql_priv.h	2006-09-15 01:47:13 +02:00
+++ 1.437/sql/mysql_priv.h	2006-09-15 01:47:13 +02:00
@@ -21,6 +21,9 @@
   except the part which must be in the server and in the client.
 */
 
+#ifndef MYSQL_PRIV_H
+#define MYSQL_PRIV_H
+
 #ifndef MYSQL_CLIENT
 
 #include <my_global.h>
@@ -2036,3 +2039,5 @@ bool schema_table_store_record(THD *thd,
 
 #endif /* MYSQL_SERVER */
 #endif /* MYSQL_CLIENT */
+
+#endif /* MYSQL_PRIV_H */

--- 1.582/sql/mysqld.cc	2006-09-15 01:47:13 +02:00
+++ 1.583/sql/mysqld.cc	2006-09-15 01:47:13 +02:00
@@ -3120,7 +3120,11 @@ with --log-bin instead.");
       global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
     else
 #endif
+#if defined(HAVE_ROW_BASED_REPLICATION)
+      global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
+#else
       global_system_variables.binlog_format= BINLOG_FORMAT_STMT;
+#endif
   }
 
   /* Check that we have not let the format to unspecified at this point */
@@ -4885,7 +4889,13 @@ struct my_option my_long_options[] =
    "supports only statement-based binary logging, so only 'statement' is "
    "a legal value."
 #endif
-   , 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
+   , 0, 0, 0, GET_STR, REQUIRED_ARG,
+#ifdef HAVE_ROW_BASED_REPLICATION
+   BINLOG_FORMAT_MIXED
+#else
+   BINLOG_FORMAT_STMT
+#endif
+   , 0, 0, 0, 0, 0 },
   {"binlog-do-db", OPT_BINLOG_DO_DB,
    "Tells the master it should log updates for the specified database, and exclude all
others not explicitly mentioned.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},

--- 1.288/sql/sql_class.cc	2006-09-15 01:47:13 +02:00
+++ 1.289/sql/sql_class.cc	2006-09-15 01:47:13 +02:00
@@ -634,6 +634,12 @@ bool THD::store_globals()
 
 void THD::cleanup_after_query()
 {
+  if (!in_sub_stmt) /* stored functions and triggers are a special case */
+  {
+    /* Forget those values, for next binlogger: */
+    stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
+    auto_inc_intervals_in_cur_stmt_for_binlog.empty();
+  }
   if (first_successful_insert_id_in_cur_stmt > 0)
   {
     /* set what LAST_INSERT_ID() will return */
@@ -2660,7 +2666,12 @@ int THD::binlog_delete_row(TABLE* table,
 int THD::binlog_flush_pending_rows_event(bool stmt_end)
 {
   DBUG_ENTER("THD::binlog_flush_pending_rows_event");
-  if (!current_stmt_binlog_row_based || !mysql_bin_log.is_open())
+  /*
+    We shall flush the pending event even if we are not in row-based
+    mode: it might be the case that we left row-based mode before
+    flushing anything (e.g., if we have explicitly locked tables).
+   */
+  if (!mysql_bin_log.is_open())
     DBUG_RETURN(0);
 
   /*
@@ -2726,6 +2737,21 @@ int THD::binlog_query(THD::enum_binlog_q
   DBUG_PRINT("enter", ("qtype=%d, query='%s'", qtype, query));
   DBUG_ASSERT(query && mysql_bin_log.is_open());
 
+  /*
+    If we are not in prelocked mode, mysql_unlock_tables() will be
+    called after this binlog_query(), so we have to flush the pending
+    rows event with the STMT_END_F set to unlock all tables at the
+    slave side as well.
+
+    If we are in prelocked mode, the flushing will be done inside the
+    top-most close_thread_tables().
+  */
+#ifdef HAVE_ROW_BASED_REPLICATION
+  if (this->prelocked_mode == NON_PRELOCKED)
+    if (int error= binlog_flush_pending_rows_event(TRUE))
+      DBUG_RETURN(error);
+#endif /*HAVE_ROW_BASED_REPLICATION*/
+
   switch (qtype) {
   case THD::MYSQL_QUERY_TYPE:
     /*
@@ -2739,25 +2765,7 @@ int THD::binlog_query(THD::enum_binlog_q
   case THD::ROW_QUERY_TYPE:
 #ifdef HAVE_ROW_BASED_REPLICATION
     if (current_stmt_binlog_row_based)
-    {
-      /*
-        If thd->lock is set, then we are not inside a stored function.
-        In that case, mysql_unlock_tables() will be called after this
-        binlog_query(), so we have to flush the pending rows event
-        with the STMT_END_F set to unlock all tables at the slave side
-        as well.
-
-        We will not flush the pending event, if thd->lock is NULL.
-        This means that we are inside a stored function or trigger, so
-        the flushing will be done inside the top-most
-        close_thread_tables().
-       */
-#ifdef HAVE_ROW_BASED_REPLICATION
-      if (this->lock)
-        DBUG_RETURN(binlog_flush_pending_rows_event(TRUE));
-#endif /*HAVE_ROW_BASED_REPLICATION*/
       DBUG_RETURN(0);
-    }
 #endif
     /* Otherwise, we fall through */
   case THD::STMT_QUERY_TYPE:

--- 1.223/sql/sql_insert.cc	2006-09-15 01:47:13 +02:00
+++ 1.224/sql/sql_insert.cc	2006-09-15 01:47:13 +02:00
@@ -572,7 +572,6 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
 
   free_underlaid_joins(thd, &thd->lex->select_lex);
   joins_freed= TRUE;
-  table->file->ha_release_auto_increment();
 
   /*
     Now all rows are inserted.  Time to update logs and sends response to
@@ -591,6 +590,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
   else
 #endif
   {
+    /*
+      Do not do this release if this is a delayed insert, it would steal
+      auto_inc values from the delayed_insert thread as they share TABLE.
+    */
+    table->file->ha_release_auto_increment();
     if (!thd->prelocked_mode && table->file->ha_end_bulk_insert()
&& !error)
     {
       table->file->print_error(my_errno,MYF(0));
@@ -2114,8 +2118,16 @@ bool delayed_insert::handle_inserts(void
 
     thd.start_time=row->start_time;
     thd.query_start_used=row->query_start_used;
-    /* for the binlog, forget auto_increment ids generated by previous rows */
-//    thd.auto_inc_intervals_in_cur_stmt_for_binlog.empty();
+    /*
+      To get the exact auto_inc interval to store in the binlog we must not
+      use values from the previous interval (of the previous rows).
+    */
+    bool log_query= (row->log_query && row->query.str != NULL);
+    if (log_query)
+    {
+      table->file->ha_release_auto_increment();
+      thd.auto_inc_intervals_in_cur_stmt_for_binlog.empty();
+    }
     thd.first_successful_insert_id_in_prev_stmt= 
       row->first_successful_insert_id_in_prev_stmt;
     thd.stmt_depends_on_first_successful_insert_id_in_prev_stmt= 
@@ -2156,7 +2168,7 @@ bool delayed_insert::handle_inserts(void
       table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
     }
 
-    if (row->log_query && row->query.str != NULL &&
mysql_bin_log.is_open())
+    if (log_query && mysql_bin_log.is_open())
     {
       /*
         If the query has several rows to insert, only the first row will come
@@ -2552,7 +2564,6 @@ bool select_insert::send_data(List<Item>
       table->next_number_field->reset();
     }
   }
-  table->file->ha_release_auto_increment();
   DBUG_RETURN(error);
 }
 
@@ -2626,6 +2637,7 @@ void select_insert::send_error(uint errc
     }
   }
   ha_rollback_stmt(thd);
+  table->file->ha_release_auto_increment();
   DBUG_VOID_RETURN;
 }
 
@@ -2676,6 +2688,7 @@ bool select_insert::send_eof()
   }
   if ((error2=ha_autocommit_or_rollback(thd,error)) && ! error)
     error=error2;
+  table->file->ha_release_auto_increment();
   if (error)
   {
     table->file->print_error(error,MYF(0));

--- 1.587/sql/sql_parse.cc	2006-09-15 01:47:13 +02:00
+++ 1.588/sql/sql_parse.cc	2006-09-15 01:47:13 +02:00
@@ -5853,9 +5853,14 @@ void mysql_reset_thd_for_next_command(TH
   DBUG_ASSERT(!thd->spcont); /* not for substatements of routines */
   thd->free_list= 0;
   thd->select_number= 1;
+  /*
+    Those two lines below are theoretically unneeded as
+    THD::cleanup_after_query() should take care of this already.
+  */
   thd->auto_inc_intervals_in_cur_stmt_for_binlog.empty();
-  thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 
-    thd->query_start_used= 0;
+  thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
+
+  thd->query_start_used= 0;
   thd->is_fatal_error= thd->time_zone_used= 0;
   thd->server_status&= ~ (SERVER_MORE_RESULTS_EXISTS | 
                           SERVER_QUERY_NO_INDEX_USED |

--- 1.368/sql/sql_show.cc	2006-09-15 01:47:13 +02:00
+++ 1.369/sql/sql_show.cc	2006-09-15 01:47:13 +02:00
@@ -1995,15 +1995,22 @@ void remove_status_vars(SHOW_VAR *list)
   }
 }
 
+inline void make_upper(char *buf)
+{
+  for (; *buf; buf++)
+    *buf= my_toupper(system_charset_info, *buf);
+}
+
 static bool show_status_array(THD *thd, const char *wild,
                               SHOW_VAR *variables,
                               enum enum_var_type value_type,
                               struct system_status_var *status_var,
-                              const char *prefix, TABLE *table)
+                              const char *prefix, TABLE *table,
+                              bool ucase_names)
 {
   char buff[SHOW_VAR_FUNC_BUFF_SIZE], *prefix_end;
-  /* the variable name should not be longer then 80 characters */
-  char name_buffer[80];
+  /* the variable name should not be longer than 64 characters */
+  char name_buffer[64];
   int len;
   LEX_STRING null_lex_str;
   SHOW_VAR tmp, *var;
@@ -2021,6 +2028,8 @@ static bool show_status_array(THD *thd, 
   {
     strnmov(prefix_end, variables->name, len);
     name_buffer[sizeof(name_buffer)-1]=0;       /* Safety */
+    if (ucase_names)
+      make_upper(name_buffer);
 
     /*
       if var->type is SHOW_FUNC, call the function.
@@ -2032,8 +2041,8 @@ static bool show_status_array(THD *thd, 
     SHOW_TYPE show_type=var->type;
     if (show_type == SHOW_ARRAY)
     {
-      show_status_array(thd, wild, (SHOW_VAR *) var->value,
-                        value_type, status_var, name_buffer, table);
+      show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type,
+                        status_var, name_buffer, table, ucase_names);
     }
     else
     {
@@ -2042,7 +2051,7 @@ static bool show_status_array(THD *thd, 
       {
         char *value=var->value;
         const char *pos, *end;                  // We assign a lot of const's
-        long nr;
+
         if (show_type == SHOW_SYS)
         {
           show_type= ((sys_var*) value)->type();
@@ -2124,6 +2133,7 @@ static bool show_status_array(THD *thd, 
         table->field[0]->store(name_buffer, strlen(name_buffer),
                                system_charset_info);
         table->field[1]->store(pos, (uint32) (end - pos), system_charset_info);
+        table->field[1]->set_notnull();
         if (schema_table_store_record(thd, table))
           DBUG_RETURN(TRUE);
       }
@@ -4564,7 +4574,7 @@ int fill_variables(THD *thd, TABLE_LIST 
   const char *wild= lex->wild ? lex->wild->ptr() : NullS;
   pthread_mutex_lock(&LOCK_global_system_variables);
   res= show_status_array(thd, wild, init_vars,
-                         lex->option_type, 0, "", tables->table);
+                         lex->option_type, 0, "", tables->table, 0);
   pthread_mutex_unlock(&LOCK_global_system_variables);
   DBUG_RETURN(res);
 }
@@ -4584,7 +4594,8 @@ int fill_status(THD *thd, TABLE_LIST *ta
                          (SHOW_VAR *)all_status_vars.buffer,
                          OPT_GLOBAL,
                          (lex->option_type == OPT_GLOBAL ?
-                          &tmp: thd->initial_status_var), "",tables->table);
+                          &tmp: thd->initial_status_var),
+                         "", tables->table, 0);
   pthread_mutex_unlock(&LOCK_status);
   DBUG_RETURN(res);
 }
@@ -4733,6 +4744,21 @@ TABLE *create_schema_table(THD *thd, TAB
         DBUG_RETURN(0);
       }
       break;
+    case MYSQL_TYPE_DECIMAL:
+      if (!(item= new Item_decimal((longlong) fields_info->value, false)))
+      {
+        DBUG_RETURN(0);
+      }
+      item->unsigned_flag= (fields_info->field_length/10000)%10;
+      item->decimals= fields_info->field_length%10;
+      item->max_length= (fields_info->field_length/100)%100;
+      if (item->unsigned_flag == 0)
+        item->max_length+= 1;
+      if (item->decimals > 0)
+        item->max_length+= 1;
+      item->set_name(fields_info->field_name,
+                     strlen(fields_info->field_name), cs);
+      break;
     default:
       /* this should be changed when Item_empty_string is fixed(in 4.1) */
       if (!(item= new Item_empty_string("", 0, cs)))
@@ -5172,6 +5198,173 @@ int fill_schema_files(THD *thd, TABLE_LI
   DBUG_RETURN(0);
 }
 
+int fill_schema_status(THD *thd, SHOW_VAR *variables,
+                       struct system_status_var *status_var,
+                       const char *prefix, TABLE *table)
+{
+  SHOW_VAR tmp, *var;
+  SHOW_TYPE show_type;
+  LEX_STRING null_lex_str;
+  char buff[SHOW_VAR_FUNC_BUFF_SIZE];
+  char name_buf[64], *name_pos;
+  int name_len;
+  DBUG_ENTER("fill_schema_status");
+  
+  null_lex_str.str= 0;
+  null_lex_str.length= 0;
+  
+  name_pos= strnmov(name_buf, prefix, sizeof(name_buf) - 1);
+  if (*prefix)
+    *name_pos++= '_';
+  name_len= name_buf + sizeof(name_buf) - name_pos;
+  
+  for (; variables->name; variables++)
+  {
+    strnmov(name_pos, variables->name, name_len);
+    name_buf[sizeof(name_buf) - 1]= 0;
+    make_upper(name_buf);
+    
+    for (var= variables; var->type == SHOW_FUNC; var= &tmp)
+      ((mysql_show_var_func)(var->value))(thd, &tmp, buff);
+      
+    show_type= var->type;
+    
+    if (show_type == SHOW_ARRAY)
+    {
+      fill_schema_status(thd, (SHOW_VAR*) var->value,
+                         status_var, name_buf, table);
+    }
+    else
+    {
+      char *value= var->value;
+      
+      restore_record(table, s->default_values);
+      table->field[0]->store(name_buf, strlen(name_buf), system_charset_info);
+      
+      if (show_type == SHOW_SYS)
+      {
+        show_type= ((sys_var*) value)->type();
+        value= (char*) ((sys_var*) value)->value_ptr(thd, OPT_GLOBAL,
+                                                     &null_lex_str);
+      }
+                                                     
+      switch (show_type)
+      {
+      case SHOW_DOUBLE_STATUS:
+        value= (char*) status_var + (ulong) value;
+        table->field[1]->store(*(double*) value);
+        break;
+      case SHOW_LONG_STATUS:
+        value= (char*) status_var + (ulong) value;
+        /* fall through */
+      case SHOW_LONG:
+      case SHOW_LONG_NOFLUSH: /* the difference lies in refresh_status() */
+        table->field[1]->store((longlong) *(long*) value, false);
+        break;
+      case SHOW_LONGLONG:
+        table->field[1]->store(*(longlong*) value, false);
+        break;
+      case SHOW_HA_ROWS:
+        table->field[1]->store((longlong) *(ha_rows*) value, false);
+        break;
+      case SHOW_BOOL:
+        table->field[1]->store((longlong) *(bool*) value, false);
+        break;
+      case SHOW_MY_BOOL:
+        table->field[1]->store((longlong) *(my_bool*) value, false);
+        break;
+      case SHOW_INT:
+        table->field[1]->store((longlong) *(uint32*) value, false);
+        break;
+      case SHOW_HAVE: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_CHAR_PTR:
+        value= *(char**) value;
+        /* fall through */
+      case SHOW_CHAR: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_KEY_CACHE_LONG:
+        value= (char*) dflt_key_cache + (ulong) value;
+        table->field[1]->store((longlong) *(long*) value, false);
+        break;
+      case SHOW_KEY_CACHE_LONGLONG:
+        value= (char*) dflt_key_cache + (ulong) value;
+        table->field[1]->store(*(longlong*) value, false);
+        break;
+      case SHOW_UNDEF: /* always displayed as 0 */
+        table->field[1]->store((longlong) 0, false);
+        break;
+      case SHOW_SYS: /* cannot happen */
+      default:
+        DBUG_ASSERT(0);
+        break;
+      }
+      
+      table->field[1]->set_notnull();
+      if (schema_table_store_record(thd, table))
+        DBUG_RETURN(1);
+    }
+  }
+  
+  DBUG_RETURN(0);
+}
+
+int fill_schema_global_status(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  STATUS_VAR tmp;
+  int res= 0;
+  DBUG_ENTER("fill_schema_global_status");
+  
+  pthread_mutex_lock(&LOCK_status);
+  calc_sum_of_all_status(&tmp);
+  res= fill_schema_status(thd, (SHOW_VAR*) all_status_vars.buffer,
+                          &tmp, "", tables->table);
+  pthread_mutex_unlock(&LOCK_status);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_session_status(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_session_status");
+  
+  pthread_mutex_lock(&LOCK_status);
+  res= fill_schema_status(thd, (SHOW_VAR*) all_status_vars.buffer,
+                          &thd->status_var, "", tables->table);
+  pthread_mutex_unlock(&LOCK_status);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_global_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_global_variables");
+  
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_GLOBAL,
+                         NULL, "", tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+  
+  DBUG_RETURN(res);
+}
+
+int fill_schema_session_variables(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+  int res= 0;
+  DBUG_ENTER("fill_schema_session_variables");
+  
+  pthread_mutex_lock(&LOCK_global_system_variables);
+  res= show_status_array(thd, "", init_vars, OPT_SESSION,
+                         NULL, "", tables->table, 1);
+  pthread_mutex_unlock(&LOCK_global_system_variables);
+  
+  DBUG_RETURN(res);
+}
+
 ST_FIELD_INFO schema_fields_info[]=
 {
   {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
@@ -5524,6 +5717,22 @@ ST_FIELD_INFO variables_fields_info[]=
 };
 
 
+ST_FIELD_INFO status_fields_info[]=
+{
+  {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
+  {"VARIABLE_VALUE", 2207, MYSQL_TYPE_DECIMAL, 0, 0, "Value"},
+  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+
+ST_FIELD_INFO system_variables_fields_info[]=
+{
+  {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
+  {"VARIABLE_VALUE", 65535, MYSQL_TYPE_STRING, 0, 1, "Value"},
+  {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+};
+
+
 ST_FIELD_INFO processlist_fields_info[]=
 {
   {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id"},
@@ -5636,6 +5845,10 @@ ST_SCHEMA_TABLE schema_tables[]=
    fill_schema_events, make_old_format, 0, -1, -1, 0},
   {"FILES", files_fields_info, create_schema_table,
    fill_schema_files, 0, 0, -1, -1, 0},
+  {"GLOBAL_STATUS", status_fields_info, create_schema_table,
+   fill_schema_global_status, make_old_format, 0, -1, -1, 0},
+  {"GLOBAL_VARIABLES", system_variables_fields_info, create_schema_table,
+   fill_schema_global_variables, make_old_format, 0, -1, -1, 0},
   {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
     get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
   {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
@@ -5655,6 +5868,10 @@ ST_SCHEMA_TABLE schema_tables[]=
    fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0},
   {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
     fill_schema_schema_privileges, 0, 0, -1, -1, 0},
+  {"SESSION_STATUS", status_fields_info, create_schema_table,
+    fill_schema_session_status, make_old_format, 0, -1, -1, 0},
+  {"SESSION_VARIABLES", system_variables_fields_info, create_schema_table,
+    fill_schema_session_variables, make_old_format, 0, -1, -1, 0},
   {"STATISTICS", stat_fields_info, create_schema_table, 
     get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0},
   {"STATUS", variables_fields_info, create_schema_table, fill_status, 

--- 1.501/sql/sql_yacc.yy	2006-09-15 01:47:13 +02:00
+++ 1.502/sql/sql_yacc.yy	2006-09-15 01:47:14 +02:00
@@ -8782,6 +8782,9 @@ load_data:
 	FROM MASTER_SYM
         {
 	  Lex->sql_command = SQLCOM_LOAD_MASTER_DATA;
+          WARN_DEPRECATED(yythd, "5.2", "LOAD DATA FROM MASTER",
+                          "mysqldump or future "
+                          "BACKUP/RESTORE DATABASE facility");
         };
 
 opt_local:

--- 1.196/mysql-test/t/disabled.def	2006-09-15 01:47:14 +02:00
+++ 1.197/mysql-test/t/disabled.def	2006-09-15 01:47:14 +02:00
@@ -22,17 +22,27 @@ ndb_load                 : BUG#17233 200
 partition_03ndb          : BUG#16385 2006-03-24 mikael Partitions: crash when updating a
range partitioned NDB table
 ps                       : BUG#21524 2006-08-08 pgalbraith 'ps' test fails in
--ps-protocol test AMD64 bit
 ps_7ndb                  : BUG#18950 2006-02-16 jmiller create table like does not obtain
LOCK_open
-rpl_ndb_2innodb          : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
-rpl_ndb_2myisam          : BUG#19227 Seems to pass currently
-#rpl_ndb_commit_afterflush : BUG#19328 2006-05-04 tomas Slave timeout with
COM_REGISTER_SLAVE error causing stop
-rpl_ndb_dd_partitions    : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD
-rpl_ndb_ddl              : BUG#18946 result file needs update + test needs to checked
-rpl_ndb_innodb2ndb       : Bug #19710  Cluster replication to partition table fails on
DELETE FROM statement
-#rpl_ndb_log              : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create
table and insert (on different table) not determ
-rpl_ndb_myisam2ndb       : Bug #19710  Cluster replication to partition table fails on
DELETE FROM statement
+rpl_deadlock_innodb      : BUG#16920 2006-04-12 kent    fails in show slave status
(randomly)
+rpl_ndb_2innodb          : BUG#19004 2006-03-22 tomas ndb: partition by range and update
hangs
+rpl_ndb_2myisam          : BUG#19004 2006-03-22 tomas ndb: partition by range and update
hangs
+rpl_ndb_auto_inc         : BUG#17086 2006-02-16 jmiller CR: auto_increment_increment and
auto_increment_offset produce duplicate key er
+rpl_ndb_commit_afterflush : LOCK TABLES cases hang in ndb injector thread
+rpl_ndb_ddl              : result file needs update + test needs to checked
+rpl_ndb_innodb2ndb       : BUG#18094 2006-03-16 mats Slave caches invalid table
definition after atlters causes select failure
+rpl_ndb_log              : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create
table and insert (on different table) not determ
+rpl_ndb_myisam2ndb       : BUG#18094 2006-03-16 mats   Slave caches invalid table
definition after atlters causes select failure
+rpl_ndb_relay_space      : BUG#16993 2006-02-16 jmiller RBR: ALTER TABLE ZEROFILL
AUTO_INCREMENT is not replicated correctly
+rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian
+rpl_row_basic_7ndb       : BUG#17400 2006-04-09 brian   Cluster Replication: delete &
update of rows in table without pk fails on slave.
 rpl_row_blob_innodb      : BUG#18980 2006-04-10 kent    Test fails randomly
+#rpl_row_func003		 : BUG#19074 2006-13-04 andrei  test failed
+#rpl_row_inexist_tbl      : BUG#18948 2006-03-09 mats    Disabled since patch makes this
test wait forever
 rpl_sp                   : BUG#16456 2006-02-16 jmiller
-rpl_sp_effects           : BUG#19862 2006-06-15 mkindahl
+rpl_sp_effects           : BUG#19862 2006-08-22 mats    Bug appear to be fixed
+rpl_until                : BUG#15886 2006-02-16 jmiller Unstable test case
+sp-goto                  : BUG#18949 2006-02-16 jmiller GOTO is currently is disabled -
will be fixed in the future
+mysqldump                : BUG#18078 2006-03-10 lars
+udf                      : BUG#18564 2006-03-27 ian     (Permission by Brian)
 
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug
open
 #ndb_binlog_ddl_multi     : BUG#18976 2006-04-10 kent    CRBR: multiple binlog, second
binlog may miss schema log events

--- 1.91/mysql-test/r/variables.result	2006-09-15 01:47:14 +02:00
+++ 1.92/mysql-test/r/variables.result	2006-09-15 01:47:14 +02:00
@@ -103,21 +103,36 @@ set max_join_size=100;
 show variables like 'max_join_size';
 Variable_name	Value
 max_join_size	100
+select * from information_schema.session_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	100
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	10
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	10
 set GLOBAL max_join_size=2000;
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	2000
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	2000
 set max_join_size=DEFAULT;
 show variables like 'max_join_size';
 Variable_name	Value
 max_join_size	2000
+select * from information_schema.session_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	2000
 set GLOBAL max_join_size=DEFAULT;
 show global variables like 'max_join_size';
 Variable_name	Value
 max_join_size	HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MAX_JOIN_SIZE	HA_POS_ERROR
 set @@max_join_size=1000, @@global.max_join_size=2000;
 select @@local.max_join_size, @@global.max_join_size;
 @@local.max_join_size	@@global.max_join_size
@@ -149,14 +164,23 @@ set global concurrent_insert=2;
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	2
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	2
 set global concurrent_insert=1;
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	1
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	1
 set global concurrent_insert=0;
 show variables like 'concurrent_insert';
 Variable_name	Value
 concurrent_insert	0
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
+VARIABLE_NAME	VARIABLE_VALUE
+CONCURRENT_INSERT	0
 set global concurrent_insert=DEFAULT;
 select @@concurrent_insert;
 @@concurrent_insert
@@ -165,26 +189,44 @@ set global timed_mutexes=ON;
 show variables like 'timed_mutexes';
 Variable_name	Value
 timed_mutexes	ON
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
+VARIABLE_NAME	VARIABLE_VALUE
+TIMED_MUTEXES	ON
 set global timed_mutexes=0;
 show variables like 'timed_mutexes';
 Variable_name	Value
 timed_mutexes	OFF
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
+VARIABLE_NAME	VARIABLE_VALUE
+TIMED_MUTEXES	OFF
 set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
 show local variables like 'storage_engine';
 Variable_name	Value
 storage_engine	MEMORY
+select * from information_schema.session_variables where variable_name like
'storage_engine';
+VARIABLE_NAME	VARIABLE_VALUE
+STORAGE_ENGINE	MEMORY
 show global variables like 'storage_engine';
 Variable_name	Value
 storage_engine	MRG_MYISAM
+select * from information_schema.global_variables where variable_name like
'storage_engine';
+VARIABLE_NAME	VARIABLE_VALUE
+STORAGE_ENGINE	MRG_MYISAM
 set GLOBAL query_cache_size=100000;
 set GLOBAL myisam_max_sort_file_size=2000000;
 show global variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	1048576
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE	1048576
 set GLOBAL myisam_max_sort_file_size=default;
 show variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	FILE_SIZE
+select * from information_schema.session_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE	FILE_SIZE
 set global net_retry_count=10, session net_retry_count=10;
 set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
 set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
@@ -194,12 +236,24 @@ net_buffer_length	1024
 net_read_timeout	300
 net_retry_count	10
 net_write_timeout	200
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
+NET_READ_TIMEOUT	300
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	200
 show session variables like 'net_%';
 Variable_name	Value
 net_buffer_length	2048
 net_read_timeout	600
 net_retry_count	10
 net_write_timeout	500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	2048
+NET_READ_TIMEOUT	600
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	500
 set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
 show global variables like 'net_%';
 Variable_name	Value
@@ -207,24 +261,45 @@ net_buffer_length	1024
 net_read_timeout	900
 net_retry_count	10
 net_write_timeout	1000
+select * from information_schema.global_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
+NET_READ_TIMEOUT	900
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	1000
 show session variables like 'net_%';
 Variable_name	Value
 net_buffer_length	7168
 net_read_timeout	600
 net_retry_count	10
 net_write_timeout	500
+select * from information_schema.session_variables where variable_name like 'net_%';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	7168
+NET_READ_TIMEOUT	600
+NET_RETRY_COUNT	10
+NET_WRITE_TIMEOUT	500
 set net_buffer_length=1;
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1024
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1024
 set net_buffer_length=2000000000;
 show variables like 'net_buffer_length';
 Variable_name	Value
 net_buffer_length	1048576
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
+VARIABLE_NAME	VARIABLE_VALUE
+NET_BUFFER_LENGTH	1048576
 set character set cp1251_koi8;
 show variables like "character_set_client";
 Variable_name	Value
 character_set_client	cp1251
+select * from information_schema.session_variables where variable_name like
'character_set_client';
+VARIABLE_NAME	VARIABLE_VALUE
+CHARACTER_SET_CLIENT	cp1251
 select @@timestamp>0;
 @@timestamp>0
 1
@@ -239,6 +314,13 @@ query_prealloc_size	8192
 range_alloc_block_size	2048
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	8192
+QUERY_PREALLOC_SIZE	8192
+RANGE_ALLOC_BLOCK_SIZE	2048
+TRANSACTION_ALLOC_BLOCK_SIZE	8192
+TRANSACTION_PREALLOC_SIZE	4096
 set @@range_alloc_block_size=1024*16;
 set @@query_alloc_block_size=1024*17+2;
 set @@query_prealloc_size=1024*18;
@@ -254,6 +336,13 @@ query_prealloc_size	18432
 range_alloc_block_size	16384
 transaction_alloc_block_size	19456
 transaction_prealloc_size	20480
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	17408
+QUERY_PREALLOC_SIZE	18432
+RANGE_ALLOC_BLOCK_SIZE	16384
+TRANSACTION_ALLOC_BLOCK_SIZE	19456
+TRANSACTION_PREALLOC_SIZE	20480
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
@@ -264,6 +353,13 @@ query_prealloc_size	8192
 range_alloc_block_size	2048
 transaction_alloc_block_size	8192
 transaction_prealloc_size	4096
+select * from information_schema.session_variables where variable_name like '%alloc%';
+VARIABLE_NAME	VARIABLE_VALUE
+QUERY_ALLOC_BLOCK_SIZE	8192
+QUERY_PREALLOC_SIZE	8192
+RANGE_ALLOC_BLOCK_SIZE	2048
+TRANSACTION_ALLOC_BLOCK_SIZE	8192
+TRANSACTION_PREALLOC_SIZE	4096
 SELECT @@version LIKE 'non-existent';
 @@version LIKE 'non-existent'
 0
@@ -485,6 +581,9 @@ set global myisam_max_sort_file_size=429
 show global variables like 'myisam_max_sort_file_size';
 Variable_name	Value
 myisam_max_sort_file_size	MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_MAX_SORT_FILE_SIZE	MAX_FILE_SIZE
 set global myisam_max_sort_file_size=default;
 select @@global.max_user_connections,@@local.max_join_size;
 @@global.max_user_connections	@@local.max_join_size
@@ -524,18 +623,30 @@ set @tstlw = @@log_warnings;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	1
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	1
 set global log_warnings = 0;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	0
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	0
 set global log_warnings = 42;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	42
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	42
 set global log_warnings = @tstlw;
 show global variables like 'log_warnings';
 Variable_name	Value
 log_warnings	1
+select * from information_schema.global_variables where variable_name like
'log_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_WARNINGS	1
 create table t1 (
 c1 tinyint,
 c2 smallint,
@@ -567,10 +678,16 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
 SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
 Variable_name	Value
 myisam_data_pointer_size	7
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'MYISAM_DATA_POINTER_SIZE';
+VARIABLE_NAME	VARIABLE_VALUE
+MYISAM_DATA_POINTER_SIZE	7
 SET GLOBAL table_open_cache=-1;
 SHOW VARIABLES LIKE 'table_open_cache';
 Variable_name	Value
 table_open_cache	1
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'table_open_cache';
+VARIABLE_NAME	VARIABLE_VALUE
+TABLE_OPEN_CACHE	1
 SET GLOBAL table_open_cache=DEFAULT;
 set character_set_results=NULL;
 select ifnull(@@character_set_results,"really null");
@@ -639,21 +756,36 @@ set @@sql_big_selects = 1;
 show variables like 'sql_big_selects';
 Variable_name	Value
 sql_big_selects	ON
+select * from information_schema.session_variables where variable_name like
'sql_big_selects';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_BIG_SELECTS	ON
 set @@sql_big_selects = @old_sql_big_selects;
 set @@sql_notes = 0, @@sql_warnings = 0;
 show variables like 'sql_notes';
 Variable_name	Value
 sql_notes	OFF
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_NOTES	OFF
 show variables like 'sql_warnings';
 Variable_name	Value
 sql_warnings	OFF
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_WARNINGS	OFF
 set @@sql_notes = 1, @@sql_warnings = 1;
 show variables like 'sql_notes';
 Variable_name	Value
 sql_notes	ON
+select * from information_schema.session_variables where variable_name like 'sql_notes';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_NOTES	ON
 show variables like 'sql_warnings';
 Variable_name	Value
 sql_warnings	ON
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
+VARIABLE_NAME	VARIABLE_VALUE
+SQL_WARNINGS	ON
 select @@system_time_zone;
 @@system_time_zone
 #
@@ -667,12 +799,21 @@ select @@basedir, @@datadir, @@tmpdir;
 show variables like 'basedir';
 Variable_name	Value
 basedir	#
+select * from information_schema.session_variables where variable_name like 'basedir';
+VARIABLE_NAME	VARIABLE_VALUE
+BASEDIR	#
 show variables like 'datadir';
 Variable_name	Value
 datadir	#
+select * from information_schema.session_variables where variable_name like 'datadir';
+VARIABLE_NAME	VARIABLE_VALUE
+DATADIR	#
 show variables like 'tmpdir';
 Variable_name	Value
 tmpdir	#
+select * from information_schema.session_variables where variable_name like 'tmpdir';
+VARIABLE_NAME	VARIABLE_VALUE
+TMPDIR	#
 select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
 @@ssl_ca	@@ssl_capath	@@ssl_cert	@@ssl_cipher	@@ssl_key
 #	#	#	#	#
@@ -683,18 +824,22 @@ ssl_capath	#
 ssl_cert	#
 ssl_cipher	#
 ssl_key	#
+select * from information_schema.session_variables where variable_name like 'ssl%';
+VARIABLE_NAME	VARIABLE_VALUE
+SSL_CA	#
+SSL_CAPATH	#
+SSL_CERT	#
+SSL_CIPHER	#
+SSL_KEY	#
 select @@log_queries_not_using_indexes;
 @@log_queries_not_using_indexes
 0
 show variables like 'log_queries_not_using_indexes';
 Variable_name	Value
 log_queries_not_using_indexes	OFF
-select @@"";
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '""' at line 1
-select @@&;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '&' at line 1
-select @@@;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '@' at line 1
+select * from information_schema.session_variables where variable_name like
'log_queries_not_using_indexes';
+VARIABLE_NAME	VARIABLE_VALUE
+LOG_QUERIES_NOT_USING_INDEXES	OFF
 End of 5.0 tests
 set global binlog_cache_size         =@my_binlog_cache_size;
 set global connect_timeout           =@my_connect_timeout;

--- 1.64/mysql-test/t/variables.test	2006-09-15 01:47:14 +02:00
+++ 1.65/mysql-test/t/variables.test	2006-09-15 01:47:14 +02:00
@@ -83,16 +83,24 @@ drop table t1;
 set GLOBAL max_join_size=10;
 set max_join_size=100;
 show variables like 'max_join_size';
+select * from information_schema.session_variables where variable_name like
'max_join_size';
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set GLOBAL max_join_size=2000;
 show global variables like 'max_join_size';
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set max_join_size=DEFAULT;
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.session_variables where variable_name like
'max_join_size';
 set GLOBAL max_join_size=DEFAULT;
 --replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
 show global variables like 'max_join_size';
+--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
+select * from information_schema.global_variables where variable_name like
'max_join_size';
 set @@max_join_size=1000, @@global.max_join_size=2000;
 select @@local.max_join_size, @@global.max_join_size;
 select @@identity,  length(@@version)>0;
@@ -106,50 +114,68 @@ set big_tables=OFF, big_tables=ON, big_t
 
 set global concurrent_insert=2;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=1;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=0;
 show variables like 'concurrent_insert';
+select * from information_schema.session_variables where variable_name like
'concurrent_insert';
 set global concurrent_insert=DEFAULT;
 select @@concurrent_insert;
 
 set global timed_mutexes=ON;
 show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
 set global timed_mutexes=0;
 show variables like 'timed_mutexes';
+select * from information_schema.session_variables where variable_name like
'timed_mutexes';
 
 set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
 show local variables like 'storage_engine';
+select * from information_schema.session_variables where variable_name like
'storage_engine';
 show global variables like 'storage_engine';
+select * from information_schema.global_variables where variable_name like
'storage_engine';
 set GLOBAL query_cache_size=100000;
 
 set GLOBAL myisam_max_sort_file_size=2000000;
 show global variables like 'myisam_max_sort_file_size';
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
 set GLOBAL myisam_max_sort_file_size=default;
 --replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
 show variables like 'myisam_max_sort_file_size';
+--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
+select * from information_schema.session_variables where variable_name like
'myisam_max_sort_file_size';
 
 set global net_retry_count=10, session net_retry_count=10;
 set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
 set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
 show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
 show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
 set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
 show global variables like 'net_%';
+select * from information_schema.global_variables where variable_name like 'net_%';
 show session variables like 'net_%';
+select * from information_schema.session_variables where variable_name like 'net_%';
 set net_buffer_length=1;
 show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
 set net_buffer_length=2000000000;
 show variables like 'net_buffer_length';
+select * from information_schema.session_variables where variable_name like
'net_buffer_length';
 
 set character set cp1251_koi8;
 show variables like "character_set_client";
+select * from information_schema.session_variables where variable_name like
'character_set_client';
 select @@timestamp>0;
 
 set @@rand_seed1=10000000,@@rand_seed2=1000000;
 select ROUND(RAND(),5);
 
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 set @@range_alloc_block_size=1024*16;
 set @@query_alloc_block_size=1024*17+2;
 set @@query_prealloc_size=1024*18;
@@ -157,10 +183,12 @@ set @@transaction_alloc_block_size=1024*
 set @@transaction_prealloc_size=1024*21-1;
 select @@query_alloc_block_size;
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 set @@range_alloc_block_size=default;
 set @@query_alloc_block_size=default, @@query_prealloc_size=default;
 set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
 show variables like '%alloc%';
+select * from information_schema.session_variables where variable_name like '%alloc%';
 
 #
 # Bug #10904 Illegal mix of collations between
@@ -363,6 +391,8 @@ set global ft_boolean_syntax = @@init_co
 set global myisam_max_sort_file_size=4294967296;
 --replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
 show global variables like 'myisam_max_sort_file_size';
+--replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
+select * from information_schema.global_variables where variable_name like
'myisam_max_sort_file_size';
 set global myisam_max_sort_file_size=default;
 
 #
@@ -398,12 +428,16 @@ SELECT @@global.local.key_buffer_size;
 # BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
 set @tstlw = @@log_warnings;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = 0;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = 42;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 set global log_warnings = @tstlw;
 show global variables like 'log_warnings';
+select * from information_schema.global_variables where variable_name like
'log_warnings';
 
 #
 # BUG#4788 show create table provides incorrect statement
@@ -435,6 +469,7 @@ drop table t1;
 
 SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
 SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'MYISAM_DATA_POINTER_SIZE';
 
 #
 # Bug #6958: negative arguments to integer options wrap around
@@ -442,6 +477,7 @@ SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER
 
 SET GLOBAL table_open_cache=-1;
 SHOW VARIABLES LIKE 'table_open_cache';
+SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE
'table_open_cache';
 SET GLOBAL table_open_cache=DEFAULT;
 
 #
@@ -527,6 +563,7 @@ select @@global.character_set_filesystem
 set @old_sql_big_selects = @@sql_big_selects;
 set @@sql_big_selects = 1;
 show variables like 'sql_big_selects';
+select * from information_schema.session_variables where variable_name like
'sql_big_selects';
 set @@sql_big_selects = @old_sql_big_selects;
 
 #
@@ -535,10 +572,14 @@ set @@sql_big_selects = @old_sql_big_sel
 # 
 set @@sql_notes = 0, @@sql_warnings = 0;
 show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
 show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
 set @@sql_notes = 1, @@sql_warnings = 1;
 show variables like 'sql_notes';
+select * from information_schema.session_variables where variable_name like 'sql_notes';
 show variables like 'sql_warnings';
+select * from information_schema.session_variables where variable_name like
'sql_warnings';
 
 #
 # Bug #12792: @@system_time_zone is not SELECTable.
@@ -565,9 +606,15 @@ select @@basedir, @@datadir, @@tmpdir;
 --replace_column 2 #
 show variables like 'basedir';
 --replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'basedir';
+--replace_column 2 #
 show variables like 'datadir';
 --replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'datadir';
+--replace_column 2 #
 show variables like 'tmpdir';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'tmpdir';
 
 #
 # Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
@@ -577,6 +624,8 @@ show variables like 'tmpdir';
 select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
 --replace_column 2 #
 show variables like 'ssl%';
+--replace_column 2 #
+select * from information_schema.session_variables where variable_name like 'ssl%';
 
 #
 # Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
@@ -584,6 +633,7 @@ show variables like 'ssl%';
 #
 select @@log_queries_not_using_indexes;
 show variables like 'log_queries_not_using_indexes';
+select * from information_schema.session_variables where variable_name like
'log_queries_not_using_indexes';
 
 #
 # Bug#20908: Crash if select @@""

--- 1.125/mysql-test/r/mysqldump.result	2006-09-15 01:47:14 +02:00
+++ 1.126/mysql-test/r/mysqldump.result	2006-09-15 01:47:14 +02:00
@@ -2920,6 +2920,131 @@ mysqldump: Couldn't execute 'SHOW MASTER
 grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
 drop table t1;
 drop user mysqltest_1@localhost;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_tables` /*!40100 DEFAULT CHARACTER
SET latin1 */;
+
+USE `mysqldump_tables`;
+DROP TABLE IF EXISTS `basetable`;
+CREATE TABLE `basetable` (
+  `id` bigint(20) unsigned NOT NULL auto_increment,
+  `tag` varchar(64) default NULL,
+  UNIQUE KEY `id` (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `basetable` WRITE;
+/*!40000 ALTER TABLE `basetable` DISABLE KEYS */;
+/*!40000 ALTER TABLE `basetable` ENABLE KEYS */;
+UNLOCK TABLES;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_views` /*!40100 DEFAULT CHARACTER SET
latin1 */;
+
+USE `mysqldump_views`;
+DROP TABLE IF EXISTS `nasishnasifu`;
+/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
+/*!50001 CREATE TABLE `nasishnasifu` (
+  `id` bigint(20) unsigned
+) */;
+/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
+/*!50001 DROP VIEW IF EXISTS `nasishnasifu`*/;
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select
`mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop view nasishnasifu;
+drop database mysqldump_views;
+drop table mysqldump_tables.basetable;
+drop database mysqldump_tables;
+USE test;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+`a b` INT,
+`c"d` INT,
+`e``f` INT,
+PRIMARY KEY (`a b`, `c"d`, `e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (0815, 4711, 2006);
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS "t1";
+CREATE TABLE "t1" (
+  "a b" int(11) NOT NULL default '0',
+  "c""d" int(11) NOT NULL default '0',
+  "e`f" int(11) NOT NULL default '0',
+  PRIMARY KEY  ("a b","c""d","e`f")
+);
+
+LOCK TABLES "t1" WRITE;
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
+INSERT INTO "t1" VALUES (815,4711,2006);
+/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a b` int(11) NOT NULL default '0',
+  `c"d` int(11) NOT NULL default '0',
+  `e``f` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`a b`,`c"d`,`e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t1` WRITE;
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+INSERT INTO `t1` VALUES (815,4711,2006);
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE `t1`;
 create database mysqldump_myDB;
 use mysqldump_myDB;
 create user myDB_User;

--- 1.118/mysql-test/t/mysqldump.test	2006-09-15 01:47:14 +02:00
+++ 1.119/mysql-test/t/mysqldump.test	2006-09-15 01:47:14 +02:00
@@ -1352,8 +1352,6 @@ drop user myDB_User;
 drop database mysqldump_myDB;
 use test;
 
---echo End of 5.0 tests
-
 # Check new --replace option
 
 --disable_warnings
@@ -1366,6 +1364,25 @@ INSERT INTO t1 VALUES (2,3);
 INSERT INTO t1 VALUES (3,4), (4,5);
 --exec $MYSQL_DUMP --replace --skip-comments test t1
 DROP TABLE t1;
+
+#
+# BUG#13926: --order-by-primary fails if PKEY contains quote character
+#
+--disable_warnings
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a b` INT,
+  `c"d` INT,
+  `e``f` INT,
+  PRIMARY KEY (`a b`, `c"d`, `e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (0815, 4711, 2006);
+
+--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
+--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
+DROP TABLE `t1`;
+--enable_warnings
+--echo End of 5.0 tests
 
 #
 # Added for use-thread option
Thread
bk commit into 5.1 tree (lars:1.2315)Lars Thalmann15 Sep