mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Merge
mysql-test/r/func_group.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/select_found.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/t/func_group.test: Auto merged mysql-test/t/show_check.test: Auto merged sql/mysqld.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_show.cc: Auto merged strings/ctype-bin.c: Auto merged sql/sql_select.cc: SCCS merged
This commit is contained in:
commit
425573747f
14 changed files with 141 additions and 6 deletions
|
@ -54,3 +54,19 @@ select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
|
|||
collation(a) collation(b) collation(binary 'ccc')
|
||||
cp1251_bin binary binary
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
a varchar(16) character set cp1251 collate cp1251_bin not null,
|
||||
b int(10) default null,
|
||||
primary key(a)
|
||||
) charset=cp1251;
|
||||
insert into t1 (a) values ('air'),
|
||||
('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
|
||||
('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
|
||||
('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
|
||||
select * from t1 where a like 'we_%';
|
||||
a b
|
||||
we_iliyan NULL
|
||||
we_ivo NULL
|
||||
we_martin NULL
|
||||
we_toshko NULL
|
||||
drop table t1;
|
||||
|
|
|
@ -757,6 +757,15 @@ one 2
|
|||
two 2
|
||||
three 1
|
||||
drop table t1;
|
||||
create table t1(a int, b datetime);
|
||||
insert into t1 values (1, NOW()), (2, NOW());
|
||||
create table t2 select MAX(b) from t1 group by a;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`MAX(b)` datetime default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
create table t1(f1 datetime);
|
||||
insert into t1 values (now());
|
||||
create table t2 select f2 from (select max(now()) f2 from t1) a;
|
||||
|
|
|
@ -129,7 +129,7 @@ FOUND_ROWS()
|
|||
1
|
||||
execute stmt1;
|
||||
FOUND_ROWS()
|
||||
0
|
||||
1
|
||||
deallocate prepare stmt1;
|
||||
drop table t1;
|
||||
create table t1
|
||||
|
|
|
@ -246,6 +246,31 @@ SELECT FOUND_ROWS();
|
|||
FOUND_ROWS()
|
||||
0
|
||||
DROP TABLE t1;
|
||||
SELECT 'foo';
|
||||
foo
|
||||
foo
|
||||
SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
1
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo';
|
||||
foo
|
||||
foo
|
||||
SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
1
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0;
|
||||
foo
|
||||
SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
1
|
||||
SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
1
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0;
|
||||
foo
|
||||
SELECT FOUND_ROWS();
|
||||
FOUND_ROWS()
|
||||
2
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
|
||||
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
|
||||
|
|
|
@ -78,4 +78,19 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
|
||||
SET MAX_SEEKS_FOR_KEY=DEFAULT;
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
set local max_join_size=8;
|
||||
select * from (select * from t1) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
set local max_join_size=1;
|
||||
select * from (select * from t1 a, t1 b) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
set local max_join_size=1;
|
||||
select * from (select 1 union select 2 union select 3) x;
|
||||
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
|
||||
drop table t1;
|
||||
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
|
||||
|
|
|
@ -252,9 +252,11 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
|
|||
drop table t1;
|
||||
create table t1 (a int not null);
|
||||
create table t2 select max(a) from t1;
|
||||
Warnings:
|
||||
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'max(a)' at row 1
|
||||
show columns from t2;
|
||||
Field Type Null Key Default Extra
|
||||
max(a) bigint(20) YES NULL
|
||||
max(a) int(11) 0
|
||||
drop table t1,t2;
|
||||
create table t1 (c decimal, d double, f float, r real);
|
||||
show columns from t1;
|
||||
|
|
|
@ -32,3 +32,17 @@ select * from t1 where lower(b)='bbb';
|
|||
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
|
||||
select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
|
||||
drop table t1;
|
||||
|
||||
# Test for BUG#8560
|
||||
create table t1 (
|
||||
a varchar(16) character set cp1251 collate cp1251_bin not null,
|
||||
b int(10) default null,
|
||||
primary key(a)
|
||||
) charset=cp1251;
|
||||
insert into t1 (a) values ('air'),
|
||||
('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
|
||||
('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
|
||||
('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
|
||||
|
||||
select * from t1 where a like 'we_%';
|
||||
drop table t1;
|
||||
|
|
|
@ -479,6 +479,15 @@ INSERT INTO t1 VALUES
|
|||
select val, count(*) from t1 group by val;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #5615: type of aggregate function column wrong when using group by
|
||||
#
|
||||
|
||||
create table t1(a int, b datetime);
|
||||
insert into t1 values (1, NOW()), (2, NOW());
|
||||
create table t2 select MAX(b) from t1 group by a;
|
||||
show create table t2;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug 7833: Wrong datatype of aggregate column is returned
|
||||
|
|
|
@ -167,6 +167,21 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
|
|||
SELECT FOUND_ROWS();
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #6089: queries which don't use any tables
|
||||
#
|
||||
|
||||
SELECT 'foo';
|
||||
SELECT FOUND_ROWS();
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo';
|
||||
SELECT FOUND_ROWS();
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0;
|
||||
SELECT FOUND_ROWS();
|
||||
SELECT FOUND_ROWS();
|
||||
|
||||
SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0;
|
||||
SELECT FOUND_ROWS();
|
||||
|
||||
#
|
||||
# Bug #7945: group by + distinct with constant expression + limit
|
||||
#
|
||||
|
|
|
@ -66,4 +66,24 @@ SET MAX_SEEKS_FOR_KEY=DEFAULT;
|
|||
|
||||
drop table t1;
|
||||
|
||||
# BUG#8726
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
|
||||
set local max_join_size=8;
|
||||
--error 1104
|
||||
select * from (select * from t1) x;
|
||||
|
||||
set local max_join_size=1;
|
||||
--error 1104
|
||||
select * from (select * from t1 a, t1 b) x;
|
||||
|
||||
set local max_join_size=1;
|
||||
--error 1104
|
||||
select * from (select 1 union select 2 union select 3) x;
|
||||
drop table t1;
|
||||
|
||||
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
|
||||
|
|
|
@ -4268,7 +4268,7 @@ struct my_option my_long_options[] =
|
|||
(gptr*) &abort_slave_event_count, (gptr*) &abort_slave_event_count,
|
||||
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif /* HAVE_REPLICATION */
|
||||
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax.", 0, 0, 0,
|
||||
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
|
||||
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"auto-increment-increment", OPT_AUTO_INCREMENT,
|
||||
"Auto-increment columns are incremented by this",
|
||||
|
|
|
@ -183,6 +183,7 @@ THD::THD()
|
|||
lock=locked_tables=0;
|
||||
used_tables=0;
|
||||
cuted_fields= sent_row_count= 0L;
|
||||
limit_found_rows= 0;
|
||||
statement_id_counter= 0UL;
|
||||
// Must be reset to handle error with THD's created for init of mysqld
|
||||
lex->current_select= 0;
|
||||
|
|
|
@ -664,7 +664,7 @@ JOIN::optimize()
|
|||
!(select_options & SELECT_DESCRIBE))
|
||||
{ /* purecov: inspected */
|
||||
my_message(ER_TOO_BIG_SELECT, ER(ER_TOO_BIG_SELECT), MYF(0));
|
||||
error= 1; /* purecov: inspected */
|
||||
error= -1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (const_tables && !thd->locked_tables &&
|
||||
|
@ -1194,7 +1194,9 @@ JOIN::exec()
|
|||
else
|
||||
error=(int) result->send_eof();
|
||||
}
|
||||
thd->limit_found_rows= thd->examined_row_count= 0;
|
||||
/* Single select (without union and limit) always returns 1 row */
|
||||
thd->limit_found_rows= 1;
|
||||
thd->examined_row_count= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
thd->limit_found_rows= thd->examined_row_count= 0;
|
||||
|
|
|
@ -67,6 +67,13 @@ static uchar bin_char_array[] =
|
|||
};
|
||||
|
||||
|
||||
static my_bool
|
||||
my_coll_init_8bit_bin(CHARSET_INFO *cs,
|
||||
void *(*alloc)(uint) __attribute__((unused)))
|
||||
{
|
||||
cs->max_sort_char=255;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const uchar *s, uint slen,
|
||||
|
@ -443,7 +450,7 @@ skip:
|
|||
|
||||
MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
|
||||
{
|
||||
NULL, /* init */
|
||||
my_coll_init_8bit_bin,
|
||||
my_strnncoll_8bit_bin,
|
||||
my_strnncollsp_8bit_bin,
|
||||
my_strnxfrm_8bit_bin,
|
||||
|
|
Loading…
Reference in a new issue