Commit 56261e0e authored by unknown's avatar unknown

Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new

into  a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new-merge_060509


configure.in:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/auto_increment.result:
  Auto merged
mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/symlink.result:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/t/mysqldump.test:
  Manual merge.
sql/sql_show.cc:
  Manual merge.
parents c8e0b5e8 fad18fe9
...@@ -750,7 +750,10 @@ dnl --------------------------------------------------------------------------- ...@@ -750,7 +750,10 @@ dnl ---------------------------------------------------------------------------
AC_DEFUN([_MYSQL_INCLUDE_LIST],[ AC_DEFUN([_MYSQL_INCLUDE_LIST],[
ifelse([$1], [], [], [ ifelse([$1], [], [], [
m4_define([__mysql_include__],[$1]) m4_define([__mysql_include__],[$1])
sinclude($1) dnl We have to use builtin(), because sinclude would generate an error
dnl "file $1 does not exists" in aclocal-1.8 - which is a bug, clearly
dnl violating m4 specs, and which is fixed in aclocal-1.9
builtin([include],$1)
m4_undefine([__mysql_include__]) m4_undefine([__mysql_include__])
_MYSQL_INCLUDE_LIST(m4_shift($@)) _MYSQL_INCLUDE_LIST(m4_shift($@))
]) ])
......
...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc) ...@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.1.10-beta) AM_INIT_AUTOMAKE(mysql, 5.1.11-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -340,7 +340,7 @@ enum ha_base_keytype { ...@@ -340,7 +340,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ #define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */ #define HA_ERR_OLD_FILE 132 /* old databasfile */
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ #define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */ #define HA_ERR_RECORD_DELETED 134 /* A record is not there */
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ #define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ #define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ #define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
......
...@@ -21,28 +21,28 @@ CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i)); ...@@ -21,28 +21,28 @@ CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i));
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL auto_increment, `i` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`i`) PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET @@SQL_MODE="MYSQL323"; SET @@SQL_MODE="MYSQL323";
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL auto_increment, `i` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`i`) PRIMARY KEY (`i`)
) TYPE=MyISAM ) TYPE=MyISAM
SET @@SQL_MODE="MYSQL40"; SET @@SQL_MODE="MYSQL40";
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL auto_increment, `i` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`i`) PRIMARY KEY (`i`)
) TYPE=MyISAM ) TYPE=MyISAM
SET @@SQL_MODE="NO_FIELD_OPTIONS"; SET @@SQL_MODE="NO_FIELD_OPTIONS";
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`i` int(11) NOT NULL, `i` int(11) NOT NULL,
PRIMARY KEY (`i`) PRIMARY KEY (`i`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
...@@ -372,9 +372,9 @@ MySQL 1002 ...@@ -372,9 +372,9 @@ MySQL 1002
SHOW CREATE TABLE `t1`; SHOW CREATE TABLE `t1`;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`t1_name` varchar(255) default NULL, `t1_name` varchar(255) DEFAULT NULL,
`t1_id` int(10) unsigned NOT NULL auto_increment, `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`t1_id`), PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`) KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`; DROP TABLE `t1`;
......
...@@ -533,3 +533,15 @@ select count(distinct concat(x,y)) from t1; ...@@ -533,3 +533,15 @@ select count(distinct concat(x,y)) from t1;
count(distinct concat(x,y)) count(distinct concat(x,y))
2 2
drop table t1; drop table t1;
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
INSERT INTO t1 VALUES (1, 101);
INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 8 NULL 16 Using where; Using index
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
a a
DROP TABLE t1;
...@@ -2116,3 +2116,25 @@ COUNT(DISTINCT a) ...@@ -2116,3 +2116,25 @@ COUNT(DISTINCT a)
1 1
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE a; DROP PROCEDURE a;
CREATE TABLE t1 (a varchar(64) NOT NULL default '', PRIMARY KEY(a));
INSERT INTO t1 (a) VALUES
(''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 66 NULL 12 Using index for group-by
SELECT DISTINCT a,a FROM t1 ORDER BY a;
a a
CENTRAL CENTRAL
EASTERN EASTERN
GREATER LONDON GREATER LONDON
NORTH CENTRAL NORTH CENTRAL
NORTH EAST NORTH EAST
NORTH WEST NORTH WEST
SCOTLAND SCOTLAND
SOUTH EAST SOUTH EAST
SOUTH WEST SOUTH WEST
WESTERN WESTERN
DROP TABLE t1;
...@@ -1718,9 +1718,9 @@ bla 1002 ...@@ -1718,9 +1718,9 @@ bla 1002
show create table `t1`; show create table `t1`;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`t1_name` varchar(255) default NULL, `t1_name` varchar(255) DEFAULT NULL,
`t1_id` int(10) unsigned NOT NULL auto_increment, `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`t1_id`), PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`) KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
DROP TABLE `t1`; DROP TABLE `t1`;
...@@ -1732,9 +1732,9 @@ bla 1002 ...@@ -1732,9 +1732,9 @@ bla 1002
show create table `t1`; show create table `t1`;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`t1_name` varchar(255) default NULL, `t1_name` varchar(255) DEFAULT NULL,
`t1_id` int(10) unsigned NOT NULL auto_increment, `t1_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`t1_id`), PRIMARY KEY (`t1_id`),
KEY `t1_name` (`t1_name`) KEY `t1_name` (`t1_name`)
) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1 ) ENGINE=MyISAM AUTO_INCREMENT=1003 DEFAULT CHARSET=latin1
drop table `t1`; drop table `t1`;
......
...@@ -949,9 +949,9 @@ insert into t1 values ...@@ -949,9 +949,9 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2); create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1; insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop table t1, t2;
drop function f1; drop function f1;
drop function f2; drop function f2;
drop table t1, t2;
create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j)); create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j));
create table t2(i int not null, n numeric(15,2), primary key(i)); create table t2(i int not null, n numeric(15,2), primary key(i));
create trigger t1_ai after insert on t1 for each row create trigger t1_ai after insert on t1 for each row
......
...@@ -382,3 +382,19 @@ INSERT INTO t1 VALUES ...@@ -382,3 +382,19 @@ INSERT INTO t1 VALUES
select count(distinct x,y) from t1; select count(distinct x,y) from t1;
select count(distinct concat(x,y)) from t1; select count(distinct concat(x,y)) from t1;
drop table t1; drop table t1;
#
# Bug #18068: SELECT DISTINCT
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
INSERT INTO t1 VALUES (1, 101);
INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
DROP TABLE t1;
...@@ -782,3 +782,19 @@ SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0; ...@@ -782,3 +782,19 @@ SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE a; DROP PROCEDURE a;
#
# Bug #18068: SELECT DISTINCT
#
CREATE TABLE t1 (a varchar(64) NOT NULL default '', PRIMARY KEY(a));
INSERT INTO t1 (a) VALUES
(''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
SELECT DISTINCT a,a FROM t1 ORDER BY a;
DROP TABLE t1;
...@@ -751,6 +751,14 @@ show create table `t1`; ...@@ -751,6 +751,14 @@ show create table `t1`;
drop table `t1`; drop table `t1`;
--echo End of 4.1 tests --echo End of 4.1 tests
# Bug #13318: Bad result with empty field and --hex-blob
#
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1;
# #
# dump of view # dump of view
......
...@@ -1111,9 +1111,9 @@ insert into t1 values ...@@ -1111,9 +1111,9 @@ insert into t1 values
create function f2() returns int return (select max(b) from t2); create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1; insert into t2 select a, f2() from t1;
load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1(); load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
drop table t1, t2;
drop function f1; drop function f1;
drop function f2; drop function f2;
drop table t1, t2;
# #
# Test for bug #16021 "Wrong index given to function in trigger" which # Test for bug #16021 "Wrong index given to function in trigger" which
......
...@@ -4306,7 +4306,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, ...@@ -4306,7 +4306,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
DBUG_EXECUTE("info", print_ror_scans_arr(param->table, DBUG_EXECUTE("info", print_ror_scans_arr(param->table,
"building covering ROR-I", "building covering ROR-I",
ror_scan_mark, ror_scans_end);); ror_scan_mark, ror_scans_end););
do { do
{
/* /*
Update changed sorting info: Update changed sorting info:
#covered fields, #covered fields,
...@@ -7387,64 +7388,69 @@ int QUICK_ROR_INTERSECT_SELECT::get_next() ...@@ -7387,64 +7388,69 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
uint last_rowid_count=0; uint last_rowid_count=0;
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next"); DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next");
/* Get a rowid for first quick and save it as a 'candidate' */ do
quick= quick_it++;
if (cpk_quick)
{ {
do { /* Get a rowid for first quick and save it as a 'candidate' */
quick= quick_it++;
if (cpk_quick)
{
do
{
error= quick->get_next();
}while (!error && !cpk_quick->row_in_ranges());
}
else
error= quick->get_next(); error= quick->get_next();
}while (!error && !cpk_quick->row_in_ranges());
}
else
error= quick->get_next();
if (error) if (error)
DBUG_RETURN(error); DBUG_RETURN(error);
quick->file->position(quick->record); quick->file->position(quick->record);
memcpy(last_rowid, quick->file->ref, head->file->ref_length); memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1; last_rowid_count= 1;
while (last_rowid_count < quick_selects.elements) while (last_rowid_count < quick_selects.elements)
{
if (!(quick= quick_it++))
{ {
quick_it.rewind(); if (!(quick= quick_it++))
quick= quick_it++; {
} quick_it.rewind();
quick= quick_it++;
do { }
if ((error= quick->get_next()))
DBUG_RETURN(error);
quick->file->position(quick->record);
cmp= head->file->cmp_ref(quick->file->ref, last_rowid);
} while (cmp < 0);
/* Ok, current select 'caught up' and returned ref >= cur_ref */ do
if (cmp > 0) {
{ if ((error= quick->get_next()))
/* Found a row with ref > cur_ref. Make it a new 'candidate' */ DBUG_RETURN(error);
if (cpk_quick) quick->file->position(quick->record);
cmp= head->file->cmp_ref(quick->file->ref, last_rowid);
} while (cmp < 0);
/* Ok, current select 'caught up' and returned ref >= cur_ref */
if (cmp > 0)
{ {
while (!cpk_quick->row_in_ranges()) /* Found a row with ref > cur_ref. Make it a new 'candidate' */
if (cpk_quick)
{ {
if ((error= quick->get_next())) while (!cpk_quick->row_in_ranges())
DBUG_RETURN(error); {
if ((error= quick->get_next()))
DBUG_RETURN(error);
}
} }
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
}
else
{
/* current 'candidate' row confirmed by this select */
last_rowid_count++;
} }
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
}
else
{
/* current 'candidate' row confirmed by this select */
last_rowid_count++;
} }
}
/* We get here iff we got the same row ref in all scans. */ /* We get here iff we got the same row ref in all scans. */
if (need_to_fetch_row) if (need_to_fetch_row)
error= head->file->rnd_pos(head->record[0], last_rowid); error= head->file->rnd_pos(head->record[0], last_rowid);
} while (error == HA_ERR_RECORD_DELETED);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -7473,41 +7479,44 @@ int QUICK_ROR_UNION_SELECT::get_next() ...@@ -7473,41 +7479,44 @@ int QUICK_ROR_UNION_SELECT::get_next()
do do
{ {
if (!queue.elements) do
DBUG_RETURN(HA_ERR_END_OF_FILE); {
/* Ok, we have a queue with >= 1 scans */ if (!queue.elements)
DBUG_RETURN(HA_ERR_END_OF_FILE);
/* Ok, we have a queue with >= 1 scans */
quick= (QUICK_SELECT_I*)queue_top(&queue); quick= (QUICK_SELECT_I*)queue_top(&queue);
memcpy(cur_rowid, quick->last_rowid, rowid_length); memcpy(cur_rowid, quick->last_rowid, rowid_length);
/* put into queue rowid from the same stream as top element */ /* put into queue rowid from the same stream as top element */
if ((error= quick->get_next())) if ((error= quick->get_next()))
{ {
if (error != HA_ERR_END_OF_FILE) if (error != HA_ERR_END_OF_FILE)
DBUG_RETURN(error); DBUG_RETURN(error);
queue_remove(&queue, 0); queue_remove(&queue, 0);
} }
else else
{ {
quick->save_last_pos(); quick->save_last_pos();
queue_replaced(&queue); queue_replaced(&queue);
} }
if (!have_prev_rowid) if (!have_prev_rowid)
{ {
/* No rows have been returned yet */ /* No rows have been returned yet */
dup_row= FALSE; dup_row= FALSE;
have_prev_rowid= TRUE; have_prev_rowid= TRUE;
} }
else else
dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid); dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid);
}while (dup_row); } while (dup_row);
tmp= cur_rowid; tmp= cur_rowid;
cur_rowid= prev_rowid; cur_rowid= prev_rowid;
prev_rowid= tmp; prev_rowid= tmp;
error= head->file->rnd_pos(quick->record, prev_rowid); error= head->file->rnd_pos(quick->record, prev_rowid);
} while (error == HA_ERR_RECORD_DELETED);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -12816,6 +12816,17 @@ create_distinct_group(THD *thd, Item **ref_pointer_array, ...@@ -12816,6 +12816,17 @@ create_distinct_group(THD *thd, Item **ref_pointer_array,
{ {
if (!item->const_item() && !item->with_sum_func && !item->marker) if (!item->const_item() && !item->with_sum_func && !item->marker)
{ {
/*
Don't put duplicate columns from the SELECT list into the
GROUP BY list.
*/
ORDER *ord_iter;
for (ord_iter= group; ord_iter; ord_iter= ord_iter->next)
if ((*ord_iter->item)->eq(item, 1))
break;
if (ord_iter)
continue;
ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER)); ORDER *ord=(ORDER*) thd->calloc(sizeof(ORDER));
if (!ord) if (!ord)
return 0; return 0;
......
...@@ -938,11 +938,9 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, ...@@ -938,11 +938,9 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
MODE_DB2 | MODE_DB2 |
MODE_MAXDB | MODE_MAXDB |
MODE_ANSI)) != 0; MODE_ANSI)) != 0;
bool limited_mysql_mode= (thd->variables.sql_mode & (MODE_NO_FIELD_OPTIONS |
bool limited_mysql_mode= (thd->variables.sql_mode & MODE_MYSQL323 |
(MODE_NO_FIELD_OPTIONS | MODE_MYSQL323 | MODE_MYSQL40)) != 0;
MODE_MYSQL40)) != 0;
DBUG_ENTER("store_create_info"); DBUG_ENTER("store_create_info");
DBUG_PRINT("enter",("table: %s", table->s->table_name.str)); DBUG_PRINT("enter",("table: %s", table->s->table_name.str));
......
#include "my_config.h"
#include <stdlib.h> #include <stdlib.h>
#include <tap.h> #include <tap.h>
......
#include "my_config.h"
#include <stdlib.h> #include <stdlib.h>
#include <tap.h> #include <tap.h>
......
#include "my_config.h"
#include <stdlib.h> #include <stdlib.h>
#include <tap.h> #include <tap.h>
......
#include "my_config.h"
#include <stdlib.h> #include <stdlib.h>
#include <tap.h> #include <tap.h>
......
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