From 7c344a582c272deac20576f894fe56caf8fff8c3 Mon Sep 17 00:00:00 2001
From: "sasha@mysql.sashanet.com" <>
Date: Sat, 11 Aug 2001 19:54:31 -0600
Subject: [PATCH] post-merge fixes to make it compile. It still fails the
 fulltext test,  (wrong error code) but I'll push it so that Sergei could
 clean up  my merge

---
 include/mysqld_error.h            |  2 +-
 mysql-test/r/order_by.result      | 56 +++++++++++++++++--------------
 sql/Makefile.am                   |  4 +--
 sql/mysql_priv.h                  |  7 ++--
 sql/mysqld.cc                     |  7 ++--
 sql/share/czech/errmsg.txt        |  1 +
 sql/share/danish/errmsg.txt       |  1 +
 sql/share/dutch/errmsg.txt        |  1 +
 sql/share/english/errmsg.txt      |  1 +
 sql/share/estonian/errmsg.txt     |  1 +
 sql/share/french/errmsg.txt       |  1 +
 sql/share/german/errmsg.txt       |  1 +
 sql/share/greek/errmsg.txt        |  1 +
 sql/share/hungarian/errmsg.txt    |  1 +
 sql/share/italian/errmsg.txt      |  1 +
 sql/share/japanese/errmsg.txt     |  1 +
 sql/share/korean/errmsg.txt       |  1 +
 sql/share/norwegian-ny/errmsg.txt |  1 +
 sql/share/norwegian/errmsg.txt    |  1 +
 sql/share/polish/errmsg.txt       |  1 +
 sql/share/portuguese/errmsg.txt   |  1 +
 sql/share/romanian/errmsg.txt     |  1 +
 sql/share/russian/errmsg.txt      |  1 +
 sql/share/slovak/errmsg.txt       |  1 +
 sql/share/spanish/errmsg.txt      |  1 +
 sql/share/swedish/errmsg.txt      |  1 +
 sql/sql_acl.cc                    |  4 +--
 27 files changed, 65 insertions(+), 36 deletions(-)

diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index d8b38d96e1..ed2965c51b 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -216,5 +216,5 @@
 #define ER_ERROR_WHEN_EXECUTING_COMMAND 1213
 #define ER_WRONG_USAGE 1214
 #define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1215
-#define ER_NO_PERSMISSION_TO_CREATE_USER 1216
+#define ER_NO_PERMISSION_TO_CREATE_USER 1216
 #define ER_ERROR_MESSAGES 217
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 79b70ac2cc..f6fc3b6090 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -111,31 +111,6 @@ DateOfAction	TransactionID
 member_id	nickname	voornaam
 1		
 2		
-gid	sid	uid
-104620	5	15
-103867	5	27
-103962	5	27
-104619	5	75
-104505	5	117
-103853	5	250
-gid	sid	uid
-104620	5	15
-103867	5	27
-103962	5	27
-104619	5	75
-104505	5	117
-103853	5	250
-table	type	possible_keys	key	key_len	ref	rows	Extra
-t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index
-t2	eq_ref	PRIMARY,uid	PRIMARY	4	t1.gid	1	
-t3	eq_ref	PRIMARY	PRIMARY	2	t2.uid	1	where used; Using index
-table	type	possible_keys	key	key_len	ref	rows	Extra
-t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index
-t3	eq_ref	PRIMARY	PRIMARY	2	t1.gid	1	where used
-table	type	possible_keys	key	key_len	ref	rows	Extra
-t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index; Using temporary; Using filesort
-t2	eq_ref	PRIMARY,uid	PRIMARY	4	t1.gid	1	
-t3	eq_ref	PRIMARY	PRIMARY	2	t2.uid	1	where used; Using index
 table	type	possible_keys	key	key_len	ref	rows	Extra
 t1	range	a	a	20	NULL	2	where used; Using index
 a	b	c
@@ -252,3 +227,34 @@ a	b	c
 1	1	
 1	0	b
 1	0	
+gid	sid	uid
+104620	5	15
+103867	5	27
+103962	5	27
+104619	5	75
+104505	5	117
+103853	5	250
+gid	sid	uid
+104620	5	15
+103867	5	27
+103962	5	27
+104619	5	75
+104505	5	117
+103853	5	250
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index
+t2	eq_ref	PRIMARY,uid	PRIMARY	4	t1.gid	1	
+t3	eq_ref	PRIMARY	PRIMARY	2	t2.uid	1	where used; Using index
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index
+t3	eq_ref	PRIMARY	PRIMARY	2	t1.gid	1	where used
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index; Using temporary; Using filesort
+t2	eq_ref	PRIMARY,uid	PRIMARY	4	t1.gid	1	
+t3	eq_ref	PRIMARY	PRIMARY	2	t2.uid	1	where used; Using index
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	index	PRIMARY	PRIMARY	4	NULL	6	Using index; Using temporary; Using filesort
+t3	eq_ref	PRIMARY	PRIMARY	2	t1.gid	1	where used
+table	type	possible_keys	key	key_len	ref	rows	Extra
+t1	ALL	NULL	NULL	NULL	NULL	6	Using temporary; Using filesort
+t3	eq_ref	PRIMARY	PRIMARY	2	t1.skr	1	where used
diff --git a/sql/Makefile.am b/sql/Makefile.am
index d3c3ff541f..3456a07977 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -80,9 +80,9 @@ mysqld_SOURCES =	sql_lex.cc sql_handler.cc \
 			sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
 			sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
 			sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \
-			slave.cc sql_repl.cc \
+			slave.cc sql_repl.cc sql_union.cc \
 			mini_client.cc mini_client_errors.c \
-			md5.c stacktrace.c
+			md5.c stacktrace.c 
 gen_lex_hash_SOURCES =	gen_lex_hash.cc
 gen_lex_hash_LDADD =	$(LDADD) $(CXXLDFLAGS)
 
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6326e3d07c..63fe65f525 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -555,13 +555,14 @@ extern ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
 	     max_insert_delayed_threads, max_user_connections,
 	     long_query_count,net_wait_timeout,net_interactive_timeout,
 	     net_read_timeout,net_write_timeout,
-	     what_to_log,flush_time,
+	     what_to_log,flush_time,opt_sql_mode,
 	     max_tmp_tables,max_heap_table_size,query_buff_size,
 	     lower_case_table_names,thread_stack,thread_stack_min,
-	     binlog_cache_size, max_binlog_cache_size;
+	     binlog_cache_size, max_binlog_cache_size,record_rnd_cache_size;
 extern ulong specialflag, current_pid;
 extern bool low_priority_updates, using_update_log;
-extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings;
+extern bool opt_sql_bin_update, opt_safe_show_db, opt_warnings,
+					     opt_safe_user_create;
 extern char language[LIBLEN],reg_ext[FN_EXTLEN],blob_newline;
 extern const char **errmesg;			/* Error messages */
 extern const char *default_tx_isolation_name;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 4d5ea1d135..77ee1890a4 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -223,7 +223,8 @@ static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
 	    opt_myisam_log=0,
             opt_large_files=sizeof(my_off_t) > 4;
 bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0,
-  opt_show_slave_auth_info = 0, opt_old_rpl_compat = 0;
+  opt_show_slave_auth_info = 0, opt_old_rpl_compat = 0,
+  opt_safe_user_create = 0;
 FILE *bootstrap_file=0;
 int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
 extern MASTER_INFO glob_mi;
@@ -271,7 +272,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
       query_buff_size, lower_case_table_names, mysqld_net_retry_count,
       net_interactive_timeout, slow_launch_time = 2L,
       net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
-      open_files_limit=0, max_binlog_size;
+      open_files_limit=0, max_binlog_size, record_rnd_cache_size;
 ulong slave_net_timeout;
 ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
 volatile ulong cached_thread_count=0;
@@ -2531,7 +2532,7 @@ enum options {
 	       OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT,
                OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
                OPT_SHOW_SLAVE_AUTH_INFO, OPT_OLD_RPL_COMPAT,
-               OPT_SQL_MODE,
+               OPT_SQL_MODE,OPT_SAFE_USER_CREATE,
                OPT_SLAVE_LOAD_TMPDIR};
 
 static struct option long_options[] = {
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt
index d4b09dcd98..4f15b56a19 100644
--- a/sql/share/czech/errmsg.txt
+++ b/sql/share/czech/errmsg.txt
@@ -226,3 +226,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt
index 59dfa0b0f3..aa4cb56595 100644
--- a/sql/share/danish/errmsg.txt
+++ b/sql/share/danish/errmsg.txt
@@ -220,3 +220,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt
index 67f9510052..33e2b78bef 100644
--- a/sql/share/dutch/errmsg.txt
+++ b/sql/share/dutch/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index 8704a3839a..61c983eefb 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt
index 584bae5c78..2fecbf38f1 100644
--- a/sql/share/estonian/errmsg.txt
+++ b/sql/share/estonian/errmsg.txt
@@ -221,3 +221,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt
index 31c08d97b1..0444dec890 100644
--- a/sql/share/french/errmsg.txt
+++ b/sql/share/french/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt
index df4dce129c..b0eb4ae1d9 100644
--- a/sql/share/german/errmsg.txt
+++ b/sql/share/german/errmsg.txt
@@ -220,3 +220,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt
index bfe8ecdfe5..0188d0a677 100644
--- a/sql/share/greek/errmsg.txt
+++ b/sql/share/greek/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt
index c44b9a28c4..14aea20fa9 100644
--- a/sql/share/hungarian/errmsg.txt
+++ b/sql/share/hungarian/errmsg.txt
@@ -219,3 +219,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 732573c3f6..07ffca9b18 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt
index b4d0d551bc..098edc3312 100644
--- a/sql/share/japanese/errmsg.txt
+++ b/sql/share/japanese/errmsg.txt
@@ -219,3 +219,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt
index 60a3e28185..19b0a275b8 100644
--- a/sql/share/korean/errmsg.txt
+++ b/sql/share/korean/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt
index 9f64e8b9e4..8067cb5189 100644
--- a/sql/share/norwegian-ny/errmsg.txt
+++ b/sql/share/norwegian-ny/errmsg.txt
@@ -219,3 +219,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt
index 64806f4bd1..67260f3aa7 100644
--- a/sql/share/norwegian/errmsg.txt
+++ b/sql/share/norwegian/errmsg.txt
@@ -219,3 +219,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt
index 34a4231b3a..aa55070162 100644
--- a/sql/share/polish/errmsg.txt
+++ b/sql/share/polish/errmsg.txt
@@ -221,3 +221,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt
index 4a755004e0..6a9334160d 100644
--- a/sql/share/portuguese/errmsg.txt
+++ b/sql/share/portuguese/errmsg.txt
@@ -217,3 +217,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt
index 2877139aa0..01f08be03c 100644
--- a/sql/share/romanian/errmsg.txt
+++ b/sql/share/romanian/errmsg.txt
@@ -221,3 +221,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt
index abeadcf5f5..75aaca498d 100644
--- a/sql/share/russian/errmsg.txt
+++ b/sql/share/russian/errmsg.txt
@@ -220,3 +220,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt
index 39435961e5..9ed6391254 100644
--- a/sql/share/slovak/errmsg.txt
+++ b/sql/share/slovak/errmsg.txt
@@ -225,3 +225,4 @@
 "Error when executing command %s: %-.128s",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt
index 67e7304812..ff00ddd482 100644
--- a/sql/share/spanish/errmsg.txt
+++ b/sql/share/spanish/errmsg.txt
@@ -218,3 +218,4 @@
 "Error de %s: %-128%",
 "Wrong usage of %s and %s",
 "The used SELECT statements have a different number of columns",
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt
index d74685736d..180b336c34 100644
--- a/sql/share/swedish/errmsg.txt
+++ b/sql/share/swedish/errmsg.txt
@@ -217,3 +217,4 @@
 "Fick fel vid utförande av %s: %-.128s",
 "Felaktig använding av %s and %s",
 "SELECT kommandona har olika antal kolumner"
+"%-.32s@%-.64s is not allowed to create new users",
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 86d3f61776..5fc3d32b81 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1003,8 +1003,8 @@ static int replace_user_table(TABLE *table, const LEX_USER &combo,
 	my_printf_error(ER_NONEXISTING_GRANT,ER(ER_NONEXISTING_GRANT),
 			MYF(0),combo.user.str,combo.host.str);
       else
-	my_printf_error(ER_NO_PERMISSON_TO_CREATE_USER,
-			ER(ER_NO_PERMISSON_TO_CREATE_USER),
+	my_printf_error(ER_NO_PERMISSION_TO_CREATE_USER,
+			ER(ER_NO_PERMISSION_TO_CREATE_USER),
 			MYF(0),thd->user,
 			thd->host ? thd->host : thd->ip ? thd->ip: "");
       error= -1;
-- 
2.30.9