MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:reggie Date:August 3 2006 2:54pm
Subject:bk commit into 5.0 tree (rburnett:1.2225)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of rburnett. When rburnett 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-08-03 16:54:06+02:00, rburnett@stripped +7 -0
  Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
  into  bk-internal.mysql.com:/data0/bk/mysql-5.0-kt
  MERGE: 1.2216.1.18

  client/mysql.cc@stripped, 2006-08-03 16:53:54+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.209.1.2

  mysql-test/r/im_life_cycle.result@stripped, 2006-08-03 16:53:54+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.6.1.1

  mysql-test/t/im_life_cycle.imtest@stripped, 2006-08-03 16:53:54+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.1

  sql/sql_lex.cc@stripped, 2006-08-03 16:53:54+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.190.1.3

  sql/sql_show.cc@stripped, 2006-08-03 16:53:55+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.323.1.1

  sql/sql_view.cc@stripped, 2006-08-03 16:53:55+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.89.1.2

  sql/table.h@stripped, 2006-08-03 16:53:56+02:00, rburnett@stripped +0 -0
    Auto merged
    MERGE: 1.129.1.2

# 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:	rburnett
# Host:	bk-internal.mysql.com
# Root:	/data0/bk/mysql-5.0-kt/RESYNC

--- 1.210/client/mysql.cc	2006-08-03 16:54:17 +02:00
+++ 1.211/client/mysql.cc	2006-08-03 16:54:17 +02:00
@@ -1221,7 +1221,8 @@
       continue;
     }
 #endif
-    if (!*ml_comment && inchar == '\\')
+    if (!*ml_comment && inchar == '\\' &&
+        !(mysql.server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES))
     {
       // Found possbile one character command like \c
 

--- 1.194/sql/sql_lex.cc	2006-08-03 16:54:17 +02:00
+++ 1.195/sql/sql_lex.cc	2006-08-03 16:54:17 +02:00
@@ -558,23 +558,20 @@
 
     case MY_LEX_IDENT_OR_NCHAR:
       if (yyPeek() != '\'')
-      {					// Found x'hex-number'
+      {					
 	state= MY_LEX_IDENT;
 	break;
       }
-      yyGet();				// Skip '
-      while ((c = yyGet()) && (c !='\'')) ;
-      length=(lex->ptr - lex->tok_start);	// Length of hexnum+3
-      if (c != '\'')
+      /* Found N'string' */
+      lex->tok_start++;                 // Skip N
+      yySkip();                         // Skip '
+      if (!(yylval->lex_str.str = get_text(lex)))
       {
-	return(ABORT_SYM);		// Illegal hex constant
+	state= MY_LEX_CHAR;             // Read char by char
+	break;
       }
-      yyGet();				// get_token makes an unget
-      yylval->lex_str=get_token(lex,length);
-      yylval->lex_str.str+=2;		// Skip x'
-      yylval->lex_str.length-=3;	// Don't count x' and last '
-      lex->yytoklen-=3;
-      return (NCHAR_STRING);
+      yylval->lex_str.length= lex->yytoklen;
+      return(NCHAR_STRING);
 
     case MY_LEX_IDENT_OR_HEX:
       if (yyPeek() == '\'')

--- 1.326/sql/sql_show.cc	2006-08-03 16:54:17 +02:00
+++ 1.327/sql/sql_show.cc	2006-08-03 16:54:17 +02:00
@@ -3140,31 +3140,18 @@
   if (tables->view)
   {
     Security_context *sctx= thd->security_ctx;
-    ulong grant= SHOW_VIEW_ACL;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-    char *save_table_name= tables->table_name;
-    if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
-                       sctx->priv_user) &&
-        !my_strcasecmp(system_charset_info, tables->definer.host.str,
-                       sctx->priv_host))
-      grant= SHOW_VIEW_ACL;
-    else
+    if (!tables->allowed_show)
     {
-      tables->table_name= tables->view_name.str;
-      if (check_access(thd, SHOW_VIEW_ACL , base_name,
-                       &tables->grant.privilege, 0, 1,
-                       test(tables->schema_table)))
-        grant= get_table_grant(thd, tables);
-      else
-        grant= tables->grant.privilege;
+      if (!my_strcasecmp(system_charset_info, tables->definer.user.str,
+                         sctx->priv_user) &&
+          !my_strcasecmp(system_charset_info, tables->definer.host.str,
+                         sctx->priv_host))
+        tables->allowed_show= TRUE;
     }
-    tables->table_name= save_table_name;
-#endif
-
     restore_record(table, s->default_values);
     table->field[1]->store(tables->view_db.str, tables->view_db.length, cs);
     table->field[2]->store(tables->view_name.str, tables->view_name.length, cs);
-    if (grant & SHOW_VIEW_ACL)
+    if (tables->allowed_show)
     {
       char buff[2048];
       String qwe_str(buff, sizeof(buff), cs);

--- 1.133/sql/table.h	2006-08-03 16:54:17 +02:00
+++ 1.134/sql/table.h	2006-08-03 16:54:17 +02:00
@@ -573,6 +573,7 @@
     tables. Unlike 'next_local', this in this list views are *not*
     leaves. Created in setup_tables() -> make_leaves_list().
   */
+  bool allowed_show;
   st_table_list	*next_leaf;
   Item          *where;                 /* VIEW WHERE clause condition */
   Item          *check_option;          /* WITH CHECK OPTION condition */

--- 1.7/mysql-test/r/im_life_cycle.result	2006-08-03 16:54:17 +02:00
+++ 1.8/mysql-test/r/im_life_cycle.result	2006-08-03 16:54:17 +02:00
@@ -1,8 +1,7 @@
-
---------------------------------------------------------------------
--- 1.1.1.
---------------------------------------------------------------------
 Success: the process has been started.
+SHOW VARIABLES LIKE 'server_id';
+Variable_name	Value
+server_id	1
 SHOW INSTANCES;
 instance_name	status
 mysqld1	online
@@ -40,10 +39,6 @@
 --------------------------------------------------------------------
 -- 1.1.6.
 --------------------------------------------------------------------
-SHOW INSTANCES;
-instance_name	status
-mysqld1	online
-mysqld2	offline
 Killing the process...
 Sleeping...
 Success: the process was restarted.

--- 1.6/mysql-test/t/im_life_cycle.imtest	2006-08-03 16:54:17 +02:00
+++ 1.7/mysql-test/t/im_life_cycle.imtest	2006-08-03 16:54:17 +02:00
@@ -7,33 +7,7 @@
 ###########################################################################
 
 --source include/im_check_os.inc
-
-###########################################################################
-#
-# 1.1.1. Check that Instance Manager is able:
-#  - to read definitions of two mysqld-instances;
-#  - to start the first instance;
-#  - to understand 'nonguarded' option and keep the second instance down;
-#
-###########################################################################
-
---echo
---echo --------------------------------------------------------------------
---echo -- 1.1.1.
---echo --------------------------------------------------------------------
-
-# Wait for mysqld1 (guarded instance) to start.
-
---exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD1_PATH_PID 30 started
-
-# Let IM detect that mysqld1 is online. This delay should be longer than
-# monitoring interval.
-
---sleep 3
-
-# Check that start conditions are as expected.
-
-SHOW INSTANCES;
+--source include/im_check_env.inc
 
 ###########################################################################
 #
@@ -54,9 +28,10 @@
 # FIXME: START INSTANCE should be synchronous.
 --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
 
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
 # SHOW INSTANCES;
 
 --connect (mysql_con,localhost,root,,mysql,$IM_MYSQLD2_PORT,$IM_MYSQLD2_SOCK)
@@ -86,9 +61,10 @@
 # FIXME: STOP INSTANCE should be synchronous.
 --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 stopped
 
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
 # SHOW INSTANCES;
 
 ###########################################################################
@@ -114,8 +90,8 @@
 
 ###########################################################################
 #
-# 1.1.5. Check that Instance Manager reports correct errors for 'STOP INSTANCE'
-# command:
+# 1.1.5. Check that Instance Manager reports correct errors for
+#        'STOP INSTANCE' command:
 #   - if the client tries to start unregistered instance;
 #   - if the client tries to start already stopped instance;
 #   - if the client submits invalid arguments;
@@ -146,12 +122,10 @@
 --echo -- 1.1.6.
 --echo --------------------------------------------------------------------
 
-SHOW INSTANCES;
-
 --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD1_PATH_PID restarted 30
 
-# Give some time to IM to detect that mysqld was restarted. It should be longer
-# than monitoring interval.
+# Give some time to IM to detect that mysqld was restarted. It should be
+# longer than monitoring interval.
 
 --sleep 3
 
@@ -172,16 +146,18 @@
 # FIXME: START INSTANCE should be synchronous.
 --exec $MYSQL_TEST_DIR/t/wait_for_process.sh $IM_MYSQLD2_PATH_PID 30 started
 
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
 # SHOW INSTANCES;
 
 --exec $MYSQL_TEST_DIR/t/kill_n_check.sh $IM_MYSQLD2_PATH_PID killed 10
 
-# FIXME: SHOW INSTANCES is not deterministic unless START INSTANCE is
-# synchronous. Even waiting for mysqld to start by looking at its pid file is
-# not enough, because IM may not detect that mysqld has started.
+# FIXME: Result of SHOW INSTANCES here is not deterministic unless START
+# INSTANCE is synchronous. Even waiting for mysqld to start by looking at
+# its pid file is not enough, because it is unknown when IM detects that
+# mysqld has started.
 # SHOW INSTANCES;
 
 ###########################################################################

--- 1.90/sql/sql_view.cc	2006-08-03 16:54:17 +02:00
+++ 1.91/sql/sql_view.cc	2006-08-03 16:54:17 +02:00
@@ -155,6 +155,54 @@
   DBUG_RETURN(TRUE);
 }
 
+/*
+  Fill defined view parts
+
+  SYNOPSIS
+    fill_defined_view_parts()
+      thd                current thread.
+      view               view to operate on
+
+  DESCRIPTION
+    This function will initialize the parts of the view 
+    definition that are not specified in ALTER VIEW
+    to their values from CREATE VIEW.
+    The view must be opened to get its definition.
+    We use a copy of the view when opening because we want 
+    to preserve the original view instance.
+
+  RETURN VALUE
+    TRUE                 can't open table
+    FALSE                success
+*/
+static bool
+fill_defined_view_parts (THD *thd, TABLE_LIST *view)
+{
+  LEX *lex= thd->lex;
+  bool not_used;
+  TABLE_LIST decoy;
+
+  memcpy (&decoy, view, sizeof (TABLE_LIST));
+  if (!open_table(thd, &decoy, thd->mem_root, &not_used, 0) &&
+      !decoy.view)
+  {
+    return TRUE;
+  }
+  if (!lex->definer)
+  {
+    view->definer.host= decoy.definer.host;
+    view->definer.user= decoy.definer.user;
+    lex->definer= &view->definer;
+  }
+  if (lex->create_view_algorithm == VIEW_ALGORITHM_UNDEFINED)
+    lex->create_view_algorithm= decoy.algorithm;
+  if (lex->create_view_suid == VIEW_SUID_DEFAULT)
+    lex->create_view_suid= decoy.view_suid ? 
+      VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
+
+  return FALSE;
+}
+
 
 /*
   Creating/altering VIEW procedure
@@ -207,7 +255,15 @@
   }
 
   if (mode != VIEW_CREATE_NEW)
+  {
+    if (mode == VIEW_ALTER &&
+        fill_defined_view_parts(thd, view))
+    {
+      res= TRUE;
+      goto err;
+    }
     sp_cache_invalidate();
+  }
 
   if (!lex->definer)
   {
@@ -671,8 +727,10 @@
   view->query.str= (char*)str.ptr();
   view->query.length= str.length()-1; // we do not need last \0
   view->source.str= thd->query + thd->lex->create_view_select_start;
-  view->source.length= (thd->query_length -
-                        thd->lex->create_view_select_start);
+  view->source.length= (char *)skip_rear_comments((uchar *)view->source.str,
+                                                  (uchar *)thd->query +
+                                                  thd->query_length) -
+                        view->source.str;
   view->file_version= 1;
   view->calc_md5(md5);
   view->md5.str= md5;
@@ -1227,8 +1285,11 @@
   DBUG_ENTER("mysql_drop_view");
   char path[FN_REFLEN];
   TABLE_LIST *view;
-  bool type= 0;
+  frm_type_enum type;
   db_type not_used;
+  String non_existant_views;
+  char *wrong_object_db= NULL, *wrong_object_name= NULL;
+  bool error= FALSE;
 
   for (view= views; view; view= view->next_local)
   {
@@ -1236,8 +1297,9 @@
              view->table_name, reg_ext, NullS);
     (void) unpack_filename(path, path);
     VOID(pthread_mutex_lock(&LOCK_open));
-    if (access(path, F_OK) ||
-	(type= (mysql_frm_type(thd, path, &not_used) != FRMTYPE_VIEW)))
+    type= FRMTYPE_ERROR;
+    if (access(path, F_OK) || 
+        FRMTYPE_VIEW != (type= mysql_frm_type(thd, path, &not_used)))
     {
       char name[FN_REFLEN];
       my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name);
@@ -1249,25 +1311,46 @@
 	VOID(pthread_mutex_unlock(&LOCK_open));
 	continue;
       }
-      if (type)
-        my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
+      if (type == FRMTYPE_TABLE)
+      {
+        if (!wrong_object_name)
+        {
+          wrong_object_db= view->db;
+          wrong_object_name= view->table_name;
+        }
+      }
       else
-        my_error(ER_BAD_TABLE_ERROR, MYF(0), name);
-      goto err;
+      {
+        if (non_existant_views.length())
+          non_existant_views.append(',');
+        non_existant_views.append(String(view->table_name,system_charset_info));
+      }
+      VOID(pthread_mutex_unlock(&LOCK_open));
+      continue;
     }
     if (my_delete(path, MYF(MY_WME)))
-      goto err;
+      error= TRUE;
     query_cache_invalidate3(thd, view, 0);
     sp_cache_invalidate();
     VOID(pthread_mutex_unlock(&LOCK_open));
   }
+  if (error)
+  {
+    DBUG_RETURN(TRUE);
+  }
+  if (wrong_object_name)
+  {
+    my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name, 
+             "VIEW");
+    DBUG_RETURN(TRUE);
+  }
+  if (non_existant_views.length())
+  {
+    my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
+    DBUG_RETURN(TRUE);
+  }
   send_ok(thd);
   DBUG_RETURN(FALSE);
-
-err:
-  VOID(pthread_mutex_unlock(&LOCK_open));
-  DBUG_RETURN(TRUE);
-
 }
 
 
Thread
bk commit into 5.0 tree (rburnett:1.2225)reggie3 Aug