Commit 77c756f3 authored by unknown's avatar unknown

Resolve merge from 4.1


BitKeeper/etc/logging_ok:
  auto-union
configure.in:
  Auto merged
myisam/mi_check.c:
  Auto merged
mysql-test/mysql-test-run.sh:
  Auto merged
client/mysqldump.c:
  Resolve merge
mysql-test/r/myisam.result:
  Resolve merge
mysql-test/r/mysqldump.result:
  Resolve merge
mysql-test/r/olap.result:
  Resolve merge
mysql-test/r/subselect.result:
  Resolve merge
mysql-test/t/myisam.test:
  Resolve merge
mysql-test/t/mysqldump.test:
  Resolve merge
mysql-test/t/olap.test:
  Resolve merge
mysql-test/t/range.test:
  Resolve merge
mysql-test/t/subselect.test:
  Resolve merge
ndb/src/common/util/version.c:
  Resolve merge
ndb/src/ndbapi/ndberror.c:
  Resolve merge
sql/item.cc:
  Resolve merge
sql/item_strfunc.h:
  Resolve merge
sql/sql_select.cc:
  Resolve merge
sql/sql_yacc.yy:
  Resolve merge
parents 50afd9b9 4ac1a1ce
......@@ -282,6 +282,7 @@ tonu@x3.internalnet
tsmith@build.mysql.com
tulin@build.mysql.com
tulin@dl145b.mysql.com
tulin@dl145c.mysql.com
tulin@mysql.com
ulli@morbus.(none)
venu@hundin.mysql.fi
......
This diff is collapsed.
......@@ -87,7 +87,7 @@ case $FLAG in
cat $FILES | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("#include \"config.h\"\n#include \"el.h\"\n");
printf("private const struct el_bindings_t el_func_help[] = {\n");
low = "abcdefghijklmnopqrstuvwxyz_";
high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
......@@ -170,7 +170,7 @@ case $FLAG in
cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("#include \"config.h\"\n#include \"el.h\"\n");
printf("private const el_func_t el_func[] = {");
maxlen = 80;
needn = 1;
......
......@@ -70,10 +70,10 @@ extern char *alloca ();
#include <fcntl.h>
#include <vis.h>
#include "readline/readline.h"
#include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */
#include "histedit.h"
#include "readline/readline.h"
/* for rl_complete() */
#define TAB '\r'
......
......@@ -37,6 +37,7 @@
/*
* search.c: History and character search functions
*/
#include <sys/types.h>
#include <stdlib.h>
#if defined(REGEX)
#include <regex.h>
......
......@@ -1812,6 +1812,7 @@ fi
fi
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
AC_CHECK_TYPES([u_int32_t])
MYSQL_PTHREAD_YIELD
......
......@@ -3244,6 +3244,9 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
cmp=ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
(uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE,
&diff_pos);
ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
(uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL,
&diff_pos);
sort_param->unique[diff_pos-1]++;
}
else
......@@ -3956,7 +3959,38 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
return;
}
/* calculate unique keys for each part key */
/*
Update statistics for each part of an index
SYNOPSIS
update_key_parts()
keyinfo Index information (only key->keysegs used)
rec_per_key_part OUT Store statistics here
unique IN Array of #distinct values collected over index
run.
records Number of records in the table
NOTES
Unique is an array:
unique[0]= (#different values of {keypart1}) - 1
unique[1]= (#different values of {keypart2,keypart1} tuple) - unique[0] - 1
...
Here we assume that NULL != NULL (see SEARCH_NULL_ARE_NOT_EQUAL). The
'unique' array is collected in one sequential scan through the entire
index. This is done in two places: in chk_index() and in sort_key_write().
Output is an array:
rec_per_key_part[k] =
= E(#records in the table such that keypart_1=c_1 AND ... AND
keypart_k=c_k for arbitrary constants c_1 ... c_k)
= {assuming that values have uniform distribution and index contains all
tuples from the domain (or that {c_1, ..., c_k} tuple is choosen from
index tuples}
= #tuples-in-the-index / #distinct-tuples-in-the-index.
*/
void update_key_parts(MI_KEYDEF *keyinfo, ulong *rec_per_key_part,
ulonglong *unique, ulonglong records)
......
......@@ -710,7 +710,7 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=
MYSQL_SHOW="$MYSQL_SHOW -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
MYSQL="$MYSQL --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
export NDB_TOOLS_DIR
......
......@@ -1260,3 +1260,17 @@ Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
set global concurrent_insert=@save_concurrent_insert;
create table t1 (a int, key(a));
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 8 NULL NULL YES BTREE
alter table t1 disable keys;
alter table t1 enable keys;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 8 NULL NULL YES BTREE
drop table t1;
......@@ -456,3 +456,36 @@ a m
NULL 3
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
CREATE TABLE t1 (a int(11));
INSERT INTO t1 VALUES (1),(2);
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
GROUP BY a;
a SUM(a) SUM(a)+1
1 1 2
2 2 3
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
GROUP BY a WITH ROLLUP;
a SUM(a) SUM(a)+1
1 1 2
2 2 3
NULL 3 4
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
GROUP BY a;
a SUM(a) SUM(a)+1
1 1 2
2 2 3
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
GROUP BY a WITH ROLLUP;
a SUM(a) SUM(a)+1
1 1 2
2 2 3
NULL 3 4
SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a)
FROM (SELECT 1 a, 2 b UNION SELECT 2,3 UNION SELECT 5,6 ) d
GROUP BY a WITH ROLLUP;
a SUM(a) SUM(a)+1 CONCAT(SUM(a),'x') SUM(a)+SUM(a) SUM(a)
1 1 2 1x 2 1
2 2 3 2x 4 2
5 5 6 5x 10 5
NULL 8 9 8x 16 8
DROP TABLE t1;
......@@ -2781,3 +2781,27 @@ c1 c2
2 NULL
3 NULL
DROP TABLE t1,t2,t3;
drop table t1
#;
CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment,
`sessionid` bigint(20) unsigned default NULL,
`time` int(10) unsigned NOT NULL default '0',
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
NULL default '',
`data` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`itemid`)
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
CREATE TABLE `t2` (
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
`pid` int(10) unsigned NOT NULL default '0',
`date` int(10) unsigned NOT NULL default '0',
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`sessionid`)
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
ip count( e.itemid )
10.10.10.1 1
drop tables t1,t2;
......@@ -660,3 +660,18 @@ select a from t1;
check table t1;
drop table t1;
set global concurrent_insert=@save_concurrent_insert;
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
# different statistics on the same table with NULL values.
create table t1 (a int, key(a));
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
analyze table t1;
show keys from t1;
alter table t1 disable keys;
alter table t1 enable keys;
show keys from t1;
drop table t1;
This diff is collapsed.
......@@ -196,3 +196,27 @@ SELECT * FROM ( SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP ) t2;
DROP TABLE t1;
set div_precision_increment= @sav_dpi;
#
# Tests for bug #7914: ROLLUP over expressions on temporary table
#
CREATE TABLE t1 (a int(11));
INSERT INTO t1 VALUES (1),(2);
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
GROUP BY a;
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
GROUP BY a WITH ROLLUP;
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
GROUP BY a;
SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
GROUP BY a WITH ROLLUP;
SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a)
FROM (SELECT 1 a, 2 b UNION SELECT 2,3 UNION SELECT 5,6 ) d
GROUP BY a WITH ROLLUP;
DROP TABLE t1;
-- source include/have_innodb.inc
#
# Problem with range optimizer
#
......
......@@ -1799,3 +1799,26 @@ SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
DROP TABLE t1,t2,t3;
#
# Item_int_with_ref check (BUG#10020)
#
CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment,
`sessionid` bigint(20) unsigned default NULL,
`time` int(10) unsigned NOT NULL default '0',
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
NULL default '',
`data` text collate latin1_general_ci NOT NULL,
PRIMARY KEY (`itemid`)
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
CREATE TABLE `t2` (
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
`pid` int(10) unsigned NOT NULL default '0',
`date` int(10) unsigned NOT NULL default '0',
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
PRIMARY KEY (`sessionid`)
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2;
......@@ -91,6 +91,8 @@ void ndbSetOwnVersion() {}
#ifndef TEST_VERSION
struct NdbUpGradeCompatible ndbCompatibleTable_full[] = {
{ MAKE_VERSION(5,0,3), MAKE_VERSION(5,0,2), UG_Exact },
{ MAKE_VERSION(4,1,12), MAKE_VERSION(4,1,10), UG_Range },
{ MAKE_VERSION(4,1,10), MAKE_VERSION(4,1,9), UG_Exact },
{ MAKE_VERSION(4,1,9), MAKE_VERSION(4,1,8), UG_Exact },
{ MAKE_VERSION(3,5,2), MAKE_VERSION(3,5,1), UG_Exact },
{ 0, 0, UG_Null }
......
......@@ -330,8 +330,8 @@ ErrorBundle ErrorCodes[] = {
{ 703, SE, "Invalid table format" },
{ 704, SE, "Attribute name too long" },
{ 705, SE, "Table name too long" },
{ 707, SE, "No more table metadata records" },
{ 708, SE, "No more attribute metadata records" },
{ 707, SE, "No more table metadata records (increase MaxNoOfTables)" },
{ 708, SE, "No more attribute metadata records (increase MaxNoOfAttributes)" },
{ 709, SE, "No such table existed" },
{ 721, OE, "Table or index with given name already exists" },
{ 723, SE, "No such table existed" },
......
......@@ -3554,7 +3554,7 @@ bool Item_int::eq(const Item *arg, bool binary_cmp) const
Item *Item_int_with_ref::new_item()
{
DBUG_ASSERT(ref->basic_const_item());
DBUG_ASSERT(ref->const_item());
/*
We need to evaluate the constant to make sure it works with
parameter markers.
......
......@@ -1320,7 +1320,7 @@ JOIN::exec()
}
curr_all_fields= &tmp_all_fields1;
curr_fields_list= &tmp_fields_list1;
set_items_ref_array(items1);
curr_join->set_items_ref_array(items1);
if (sort_and_group || curr_tmp_table->group)
{
......@@ -1455,7 +1455,7 @@ JOIN::exec()
}
curr_fields_list= &curr_join->tmp_fields_list2;
curr_all_fields= &curr_join->tmp_all_fields2;
set_items_ref_array(items2);
curr_join->set_items_ref_array(items2);
curr_join->tmp_table_param.field_count+=
curr_join->tmp_table_param.sum_func_count;
curr_join->tmp_table_param.sum_func_count= 0;
......@@ -1516,7 +1516,7 @@ JOIN::exec()
}
curr_fields_list= &tmp_fields_list3;
curr_all_fields= &tmp_all_fields3;
set_items_ref_array(items3);
curr_join->set_items_ref_array(items3);
if (curr_join->make_sum_func_list(*curr_all_fields, *curr_fields_list,
1, TRUE) ||
......
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