Commit b4ecaf07 authored by unknown's avatar unknown

Merge stella.local:/home2/mydev/mysql-5.1-amain

into  stella.local:/home2/mydev/mysql-5.1-axmrg


configure.in:
  Auto merged
mysql-test/r/partition.result:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
sql/item_func.cc:
  Auto merged
parents 41c2a2c4 ebeb7b1f
...@@ -360,6 +360,17 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[ ...@@ -360,6 +360,17 @@ AC_DEFUN([__MYSQL_EMIT_CHECK_PLUGIN],[
AC_MSG_ERROR([cannot disable mandatory plugin]) AC_MSG_ERROR([cannot disable mandatory plugin])
fi fi
[mysql_plugin_]$2=yes [mysql_plugin_]$2=yes
],[
case "$with_mysqld_ldflags " in
*"-all-static "*)
# No need to build shared plugins when mysqld is linked with
# -all-static as it won't be able to load them.
if test "X[$mysql_plugin_]$2" != Xyes -a \
"X[$with_plugin_]$2" != Xyes; then
[with_plugin_]$2=no
fi
;;
esac
]) ])
if test "X[$with_plugin_]$2" = Xno; then if test "X[$with_plugin_]$2" = Xno; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
......
...@@ -1750,7 +1750,18 @@ then ...@@ -1750,7 +1750,18 @@ then
LDFLAGS="$LDFLAGS -rdynamic" LDFLAGS="$LDFLAGS -rdynamic"
AC_MSG_RESULT("-rdynamic") AC_MSG_RESULT("-rdynamic")
else else
case "$SYSTEM_TYPE$with_mysqld_ldflags " in
*freebsd*"-all-static "*|*dragonfly*"-all-static "*)
AC_MSG_RESULT("none") AC_MSG_RESULT("none")
;;
*freebsd*|*dragonfly*)
MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
AC_MSG_RESULT("-export-dynamic")
;;
*)
AC_MSG_RESULT("none")
;;
esac
fi fi
dnl Checks for typedefs, structures, and compiler characteristics. dnl Checks for typedefs, structures, and compiler characteristics.
......
...@@ -13,20 +13,20 @@ CREATE TABLE t2 (p POINT, INDEX(p)); ...@@ -13,20 +13,20 @@ CREATE TABLE t2 (p POINT, INDEX(p));
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
-- no index, returns 1 as expected # no index, returns 1 as expected
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
-- with index, returns 1 as expected # with index, returns 1 as expected
-- EXPLAIN shows that the index is not used though # EXPLAIN shows that the index is not used though
-- due to the "most rows covered anyway, so a scan is more effective" rule # due to the "most rows covered anyway, so a scan is more effective" rule
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
-- adding another row to the table so that # adding another row to the table so that
-- the "most rows covered" rule doesn't kick in anymore # the "most rows covered" rule doesn't kick in anymore
-- now EXPLAIN shows the index used on the table # now EXPLAIN shows the index used on the table
# and we're getting the wrong result again
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
EXPLAIN EXPLAIN
......
...@@ -1163,7 +1163,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) ...@@ -1163,7 +1163,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
ENGINE = $engine_type; ENGINE = $engine_type;
INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (1,2);
--#echo 1. test for locking: --echo # 1. test for locking:
BEGIN; BEGIN;
--enable_info --enable_info
......
...@@ -811,6 +811,12 @@ quote(name) ...@@ -811,6 +811,12 @@ quote(name)
???????? ????????
???????????????? ????????????????
drop table bug20536; drop table bug20536;
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES('abcd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
a
abcd
DROP TABLE t1;
End of 4.1 tests End of 4.1 tests
CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3)); CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0); INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
......
...@@ -1426,6 +1426,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ...@@ -1426,6 +1426,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256)) CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
ENGINE = InnoDB; ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (1,2);
# 1. test for locking:
BEGIN; BEGIN;
UPDATE t1 SET b = 12 WHERE a = 1; UPDATE t1 SET b = 12 WHERE a = 1;
affected rows: 1 affected rows: 1
......
...@@ -1987,3 +1987,28 @@ Table Op Msg_type Msg_text ...@@ -1987,3 +1987,28 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 0 # # # 1024 # # # # # # #
INSERT INTO t1 VALUES (1,1);
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # #
ALTER TABLE t1 DISABLE KEYS;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # #
ALTER TABLE t1 ENABLE KEYS;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # #
ALTER TABLE t1 DISABLE KEYS;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # #
ALTER TABLE t1 ENABLE KEYS;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 1 # # # 3072 # # # # # # #
DROP TABLE t1;
drop table if exists t1; drop table if exists t1;
CREATE TABLE t1 (
d DATE NOT NULL
)
PARTITION BY RANGE( YEAR(d) ) (
PARTITION p0 VALUES LESS THAN (1960),
PARTITION p1 VALUES LESS THAN (1970),
PARTITION p2 VALUES LESS THAN (1980),
PARTITION p3 VALUES LESS THAN (1990)
);
ALTER TABLE t1 ADD PARTITION (
PARTITION `p5` VALUES LESS THAN (2010)
COMMENT 'APSTART \' APEND'
);
SELECT * FROM t1 LIMIT 1;
d
DROP TABLE t1;
create table t1 (id int auto_increment, s1 int, primary key (id));
insert into t1 values (null,1);
insert into t1 values (null,6);
select * from t1;
id s1
1 1
2 6
alter table t1 partition by range (id) (
partition p0 values less than (3),
partition p1 values less than maxvalue
);
drop table t1;
create table t1 (a int) create table t1 (a int)
partition by key(a) partition by key(a)
partitions 0.2+e1; partitions 0.2+e1;
......
...@@ -547,6 +547,14 @@ select quote(name) from bug20536; ...@@ -547,6 +547,14 @@ select quote(name) from bug20536;
drop table bug20536; drop table bug20536;
#
# BUG#31159 - fulltext search on ucs2 column crashes server
#
CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
INSERT INTO t1 VALUES('abcd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
DROP TABLE t1;
--echo End of 4.1 tests --echo End of 4.1 tests
# #
......
...@@ -1256,3 +1256,29 @@ CHECK TABLE t1; ...@@ -1256,3 +1256,29 @@ CHECK TABLE t1;
DROP TABLE t1; DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
#
# Bug#4692 - DISABLE/ENABLE KEYS waste a space
#
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
INSERT INTO t1 VALUES (1,1);
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
ALTER TABLE t1 DISABLE KEYS;
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
ALTER TABLE t1 ENABLE KEYS;
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
ALTER TABLE t1 DISABLE KEYS;
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
ALTER TABLE t1 ENABLE KEYS;
--replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 #
SHOW TABLE STATUS LIKE 't1';
#--exec ls -log var/master-data/test/t1.MYI
#--exec myisamchk -dvv var/master-data/test/t1.MYI
#--exec myisamchk -iev var/master-data/test/t1.MYI
DROP TABLE t1;
...@@ -14,6 +14,50 @@ ...@@ -14,6 +14,50 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
#
# To verify the fix for crashing (on unix-type OS)
# uncomment the exec and error rows!
CREATE TABLE t1 (
d DATE NOT NULL
)
PARTITION BY RANGE( YEAR(d) ) (
PARTITION p0 VALUES LESS THAN (1960),
PARTITION p1 VALUES LESS THAN (1970),
PARTITION p2 VALUES LESS THAN (1980),
PARTITION p3 VALUES LESS THAN (1990)
);
ALTER TABLE t1 ADD PARTITION (
PARTITION `p5` VALUES LESS THAN (2010)
COMMENT 'APSTART \' APEND'
);
#--exec sed 's/APSTART \\/APSTART /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm
#--error 1064
SELECT * FROM t1 LIMIT 1;
DROP TABLE t1;
#
# Bug 30878: crashing when alter an auto_increment non partitioned
# table to partitioned
create table t1 (id int auto_increment, s1 int, primary key (id));
insert into t1 values (null,1);
insert into t1 values (null,6);
select * from t1;
alter table t1 partition by range (id) (
partition p0 values less than (3),
partition p1 values less than maxvalue
);
drop table t1;
# #
# Bug 15890: Strange number of partitions accepted # Bug 15890: Strange number of partitions accepted
# #
......
...@@ -161,7 +161,7 @@ select * from information_schema.session_variables where variable_name like 'net ...@@ -161,7 +161,7 @@ select * from information_schema.session_variables where variable_name like 'net
set net_buffer_length=1; set net_buffer_length=1;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.session_variables where variable_name like 'net_buffer_length';
--warning 1292 #warning 1292
set net_buffer_length=2000000000; set net_buffer_length=2000000000;
show variables like 'net_buffer_length'; show variables like 'net_buffer_length';
select * from information_schema.session_variables where variable_name like 'net_buffer_length'; select * from information_schema.session_variables where variable_name like 'net_buffer_length';
......
...@@ -2678,7 +2678,8 @@ int ha_partition::write_row(uchar * buf) ...@@ -2678,7 +2678,8 @@ int ha_partition::write_row(uchar * buf)
uint32 part_id; uint32 part_id;
int error; int error;
longlong func_value; longlong func_value;
bool autoincrement_lock= false; bool autoincrement_lock= FALSE;
my_bitmap_map *old_map;
#ifdef NOT_NEEDED #ifdef NOT_NEEDED
uchar *rec0= m_rec0; uchar *rec0= m_rec0;
#endif #endif
...@@ -2705,8 +2706,17 @@ int ha_partition::write_row(uchar * buf) ...@@ -2705,8 +2706,17 @@ int ha_partition::write_row(uchar * buf)
use autoincrement_lock variable to avoid unnecessary locks. use autoincrement_lock variable to avoid unnecessary locks.
Probably not an ideal solution. Probably not an ideal solution.
*/ */
autoincrement_lock= true; if (table_share->tmp_table == NO_TMP_TABLE)
{
/*
Bug#30878 crash when alter table from non partitioned table
to partitioned.
Checking if tmp table then there is no need to lock,
and the table_share->mutex may not be initialised.
*/
autoincrement_lock= TRUE;
pthread_mutex_lock(&table_share->mutex); pthread_mutex_lock(&table_share->mutex);
}
error= update_auto_increment(); error= update_auto_increment();
/* /*
...@@ -2715,10 +2725,10 @@ int ha_partition::write_row(uchar * buf) ...@@ -2715,10 +2725,10 @@ int ha_partition::write_row(uchar * buf)
the correct partition. We must check and fail if neccessary. the correct partition. We must check and fail if neccessary.
*/ */
if (error) if (error)
DBUG_RETURN(error); goto exit;
} }
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); old_map= dbug_tmp_use_all_columns(table, table->read_set);
#ifdef NOT_NEEDED #ifdef NOT_NEEDED
if (likely(buf == rec0)) if (likely(buf == rec0))
#endif #endif
......
...@@ -1856,6 +1856,20 @@ static int add_uint(File fptr, ulonglong number) ...@@ -1856,6 +1856,20 @@ static int add_uint(File fptr, ulonglong number)
return add_string(fptr, buff); return add_string(fptr, buff);
} }
/*
Must escape strings in partitioned tables frm-files,
parsing it later with mysql_unpack_partition will fail otherwise.
*/
static int add_quoted_string(File fptr, const char *quotestr)
{
String orgstr(quotestr, system_charset_info);
String escapedstr;
int err= add_string(fptr, "'");
err+= append_escaped(&escapedstr, &orgstr);
err+= add_string(fptr, escapedstr.c_ptr());
return err + add_string(fptr, "'");
}
static int add_keyword_string(File fptr, const char *keyword, static int add_keyword_string(File fptr, const char *keyword,
bool should_use_quotes, bool should_use_quotes,
const char *keystr) const char *keystr)
...@@ -1866,10 +1880,9 @@ static int add_keyword_string(File fptr, const char *keyword, ...@@ -1866,10 +1880,9 @@ static int add_keyword_string(File fptr, const char *keyword,
err+= add_equal(fptr); err+= add_equal(fptr);
err+= add_space(fptr); err+= add_space(fptr);
if (should_use_quotes) if (should_use_quotes)
err+= add_string(fptr, "'"); err+= add_quoted_string(fptr, keystr);
else
err+= add_string(fptr, keystr); err+= add_string(fptr, keystr);
if (should_use_quotes)
err+= add_string(fptr, "'");
return err + add_space(fptr); return err + add_space(fptr);
} }
......
...@@ -6492,7 +6492,7 @@ bool_pri: ...@@ -6492,7 +6492,7 @@ bool_pri:
{ $$= (*$2)(0)->create($1,$3); } { $$= (*$2)(0)->create($1,$3); }
| bool_pri comp_op all_or_any '(' subselect ')' %prec EQ | bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
{ $$= all_any_subquery_creator($1, $2, $3, $5); } { $$= all_any_subquery_creator($1, $2, $3, $5); }
| predicate ; | predicate
; ;
predicate: predicate:
......
...@@ -1784,6 +1784,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, ...@@ -1784,6 +1784,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
outparam, is_create_table, outparam, is_create_table,
share->default_part_db_type, share->default_part_db_type,
&work_part_info_used); &work_part_info_used);
if (!tmp)
outparam->part_info->is_auto_partitioned= share->auto_partitioned; outparam->part_info->is_auto_partitioned= share->auto_partitioned;
DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned)); DBUG_PRINT("info", ("autopartitioned: %u", share->auto_partitioned));
/* we should perform the fix_partition_func in either local or /* we should perform the fix_partition_func in either local or
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment