summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-06-23 16:44:34 +0300
committermonty@mysql.com <>2004-06-23 16:44:34 +0300
commitad86016e2ff3af18892d24577e956b886bd150fd (patch)
tree65585d3f7c22945c51267af54fd8d0cafddb46e8
parentf56df164f0603b268806108526d59e5d02fef82b (diff)
downloadmariadb-git-ad86016e2ff3af18892d24577e956b886bd150fd.tar.gz
lower_case_table_names=2 (Keep case for table names) was not honored
with ALTER TABLE and CREATE/DROP INDEX. (Bug #3109) Make net_buffer_length visible for mysql clients (Bug #4206)
-rw-r--r--include/mysql.h2
-rw-r--r--libmysql/libmysql.c2
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/lowercase_table2.result10
-rw-r--r--mysql-test/t/lowercase_table2.test11
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--sql/sql_table.cc5
7 files changed, 30 insertions, 4 deletions
diff --git a/include/mysql.h b/include/mysql.h
index 7db6b36e667..8abeb86e32a 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -250,7 +250,7 @@ typedef struct st_mysql_parameters
unsigned long *p_net_buffer_length;
} MYSQL_PARAMETERS;
-#if !defined(MYSQL_CLIENT) && !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
+#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet)
#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length)
#endif
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index e3e896615d5..bac72064e1b 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -59,6 +59,8 @@
#define INADDR_NONE -1
#endif
+#undef net_buffer_length
+#undef max_allowed_packet
static my_bool mysql_client_init=0;
uint mysql_port=0;
my_string mysql_unix_port=0;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 1671e9416fb..449b7015188 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -668,7 +668,7 @@ report_stats () {
#
$RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
# Remove some non fatal warnings from the log files
- $SED -e 's!Warning: Table:.* on delete!!g' \
+ $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \
$MY_LOG_DIR/*.err > $MY_LOG_DIR/warnings.tmp
found_error=0
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index 737d49fc340..d2283927789 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -121,3 +121,13 @@ LOCATION
Mic-5
Mic-6
drop table T1;
+create table T1 (A int);
+alter table T1 add index (A);
+show tables like 'T1%';
+Tables_in_test (T1%)
+T1
+alter table t1 add index (A);
+show tables like 't1%';
+Tables_in_test (t1%)
+t1
+drop table t1;
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
index 8f542a7af78..4a56b16a441 100644
--- a/mysql-test/t/lowercase_table2.test
+++ b/mysql-test/t/lowercase_table2.test
@@ -89,3 +89,14 @@ SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHER
SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
drop table T1;
+
+#
+# Test name conversion with ALTER TABLE / CREATE INDEX (Bug #3109)
+#
+
+create table T1 (A int);
+alter table T1 add index (A);
+show tables like 'T1%';
+alter table t1 add index (A);
+show tables like 't1%';
+drop table t1;
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index c6e9f04fa91..7ab312baa5c 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -342,7 +342,7 @@ fi
echo "Installing all prepared tables"
if eval "$mysqld $defaults $mysqld_opt --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb \
- $extra_arg $args" << END_OF_DATA
+ $args" << END_OF_DATA
use mysql;
$c_d
$i_d
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 7507ab16968..03e8e895876 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1545,7 +1545,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
}
else
- new_alias= new_name= table_name;
+ {
+ new_alias= (lower_case_table_names == 2) ? alias : table_name;
+ new_name= table_name;
+ }
old_db_type=table->db_type;
if (create_info->db_type == DB_TYPE_DEFAULT)