Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7b797aaa
Commit
7b797aaa
authored
Jul 31, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B27417-5.1-opt
parents
992698ce
355c25f0
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
156 additions
and
11 deletions
+156
-11
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+17
-0
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+26
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+15
-4
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+0
-1
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+22
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+28
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+21
-0
sql/item.cc
sql/item.cc
+2
-2
sql/item.h
sql/item.h
+10
-1
sql/sp_head.cc
sql/sp_head.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+3
-1
sql/sql_select.h
sql/sql_select.h
+9
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-1
No files found.
mysql-test/r/group_by.result
View file @
7b797aaa
...
...
@@ -824,6 +824,23 @@ a
2
1
DROP TABLE t1;
CREATE TABLE t1 (
f1 int(10) unsigned NOT NULL auto_increment primary key,
f2 varchar(100) NOT NULL default ''
);
CREATE TABLE t2 (
f1 varchar(10) NOT NULL default '',
f2 char(3) NOT NULL default '',
PRIMARY KEY (`f1`),
KEY `k1` (`f2`,`f1`)
);
INSERT INTO t1 values(NULL, '');
INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
avg(t2.f1)
SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
avg(t2.f1)
DROP TABLE t1, t2;
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
...
...
mysql-test/r/insert_select.result
View file @
7b797aaa
...
...
@@ -699,6 +699,32 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 1
DROP TABLE t1;
CREATE TABLE t1 (
f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
f2 varchar(100) NOT NULL default ''
);
CREATE TABLE t2 (
f1 varchar(10) NOT NULL default '',
f2 char(3) NOT NULL default '',
PRIMARY KEY (`f1`),
KEY `k1` (`f2`, `f1`)
);
INSERT INTO t1 values(NULL, '');
INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
min(t2.f1)
INSERT INTO t1 (f2)
SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SELECT * FROM t1;
f1 f2
1
DROP TABLE t1, t2;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
...
...
mysql-test/r/sp.result
View file @
7b797aaa
...
...
@@ -6378,6 +6378,17 @@ Level Code Message
use test;
drop procedure sp_bug29050;
drop table t1;
SET NAMES latin1;
CREATE PROCEDURE p1()
BEGIN
DECLARE INT;
SELECT ;
END|
CALL p1();
NULL
SET NAMES default;
DROP PROCEDURE p1;
drop procedure if exists proc_25411_a;
drop procedure if exists proc_25411_b;
drop procedure if exists proc_25411_c;
...
...
@@ -6420,7 +6431,7 @@ select 1;
select 3;
select 4;
end
utf8 utf8_general
_ci latin1_swedish_ci
end
latin1 latin1_swedish
_ci latin1_swedish_ci
call proc_25411_a();
1
1
...
...
@@ -6440,7 +6451,7 @@ proc_25411_b CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_25411_b`(
)
begin
select p1, p2;
end
utf8 utf8_general
_ci latin1_swedish_ci
end
latin1 latin1_swedish
_ci latin1_swedish_ci
select name, param_list, body from mysql.proc where name like "%25411%";
name param_list body
proc_25411_a begin
...
...
@@ -6478,7 +6489,7 @@ select 1 ,2 ,3;
select 1,2 ,3 ;
select 1 ,2 ,3 ;
select 1 ,2 ,3 ;
end
utf8 utf8_general
_ci latin1_swedish_ci
end
latin1 latin1_swedish
_ci latin1_swedish_ci
call proc_25411_c();
1 2 3
1 2 3
...
...
@@ -6499,7 +6510,7 @@ select 1 /* testing */;
show create procedure proc_26302;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
proc_26302 CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_26302`()
select 1 /* testing */
utf8 utf8_general
_ci latin1_swedish_ci
select 1 /* testing */
latin1 latin1_swedish
_ci latin1_swedish_ci
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES
where ROUTINE_NAME = "proc_26302";
ROUTINE_NAME ROUTINE_DEFINITION
...
...
mysql-test/t/disabled.def
View file @
7b797aaa
...
...
@@ -25,4 +25,3 @@ ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Do
mysql_upgrade : Bug#28560 test links to /usr/local/mysql/lib libraries, causes non-determinism and failures on ABI breakage
federated_transactions : Bug#29523 Transactions do not work
ddl_i18n_koi8r : Bug #30120 SP with local variables with non-ASCII names crashes server
mysql-test/t/group_by.test
View file @
7b797aaa
...
...
@@ -633,6 +633,28 @@ SELECT a FROM t1 ORDER BY "a" DESC;
SELECT
a
FROM
t1
ORDER
BY
`a`
DESC
;
DROP
TABLE
t1
;
#
# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself
# returns empty
#
CREATE
TABLE
t1
(
f1
int
(
10
)
unsigned
NOT
NULL
auto_increment
primary
key
,
f2
varchar
(
100
)
NOT
NULL
default
''
);
CREATE
TABLE
t2
(
f1
varchar
(
10
)
NOT
NULL
default
''
,
f2
char
(
3
)
NOT
NULL
default
''
,
PRIMARY
KEY
(
`f1`
),
KEY
`k1`
(
`f2`
,
`f1`
)
);
INSERT
INTO
t1
values
(
NULL
,
''
);
INSERT
INTO
`t2`
VALUES
(
'486878'
,
'WDT'
),(
'486910'
,
'WDT'
);
SELECT
SQL_BUFFER_RESULT
avg
(
t2
.
f1
)
FROM
t1
,
t2
where
t2
.
f2
=
'SIR'
GROUP
BY
t1
.
f1
;
SELECT
avg
(
t2
.
f1
)
FROM
t1
,
t2
where
t2
.
f2
=
'SIR'
GROUP
BY
t1
.
f1
;
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
#
...
...
mysql-test/t/insert_select.test
View file @
7b797aaa
...
...
@@ -239,6 +239,34 @@ show status like 'Handler_read%';
DROP
TABLE
t1
;
#
# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty
#
CREATE
TABLE
t1
(
f1
int
(
10
)
unsigned
NOT
NULL
auto_increment
PRIMARY
KEY
,
f2
varchar
(
100
)
NOT
NULL
default
''
);
CREATE
TABLE
t2
(
f1
varchar
(
10
)
NOT
NULL
default
''
,
f2
char
(
3
)
NOT
NULL
default
''
,
PRIMARY
KEY
(
`f1`
),
KEY
`k1`
(
`f2`
,
`f1`
)
);
INSERT
INTO
t1
values
(
NULL
,
''
);
INSERT
INTO
`t2`
VALUES
(
'486878'
,
'WDT'
),(
'486910'
,
'WDT'
);
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
min
(
t2
.
f1
)
FROM
t1
,
t2
where
t2
.
f2
=
'SIR'
GROUP
BY
t1
.
f1
;
INSERT
INTO
t1
(
f2
)
SELECT
min
(
t2
.
f1
)
FROM
t1
,
t2
where
t2
.
f2
=
'SIR'
GROUP
BY
t1
.
f1
;
SELECT
COUNT
(
*
)
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
#
...
...
mysql-test/t/sp.test
View file @
7b797aaa
...
...
@@ -7364,6 +7364,27 @@ use test;
drop
procedure
sp_bug29050
;
drop
table
t1
;
#
# Bug #30120 SP with local variables with non-ASCII names crashes server.
#
SET
NAMES
latin1
;
DELIMITER
|
;
CREATE
PROCEDURE
p1
()
BEGIN
DECLARE
INT
;
SELECT
;
END
|
DELIMITER
;
|
CALL
p1
();
SET
NAMES
default
;
DROP
PROCEDURE
p1
;
#
# Bug#25411 (trigger code truncated)
#
...
...
sql/item.cc
View file @
7b797aaa
...
...
@@ -1082,9 +1082,9 @@ bool Item_sp_variable::is_null()
Item_splocal
::
Item_splocal
(
const
LEX_STRING
&
sp_var_name
,
uint
sp_var_idx
,
enum_field_types
sp_var_type
,
uint
pos_in_q
)
uint
pos_in_q
,
uint
len_in_q
)
:
Item_sp_variable
(
sp_var_name
.
str
,
sp_var_name
.
length
),
m_var_idx
(
sp_var_idx
),
pos_in_query
(
pos_in_q
)
m_var_idx
(
sp_var_idx
),
pos_in_query
(
pos_in_q
)
,
len_in_query
(
len_in_q
)
{
maybe_null
=
TRUE
;
...
...
sql/item.h
View file @
7b797aaa
...
...
@@ -1054,9 +1054,18 @@ public:
SP variable in query text.
*/
uint
pos_in_query
;
/*
Byte length of SP variable name in the statement (see pos_in_query).
The value of this field may differ from the name_length value because
name_length contains byte length of UTF8-encoded item name, but
the query string (see sp_instr_stmt::m_query) is currently stored with
a charset from the SET NAMES statement.
*/
uint
len_in_query
;
Item_splocal
(
const
LEX_STRING
&
sp_var_name
,
uint
sp_var_idx
,
enum_field_types
sp_var_type
,
uint
pos_in_q
=
0
);
enum_field_types
sp_var_type
,
uint
pos_in_q
=
0
,
uint
len_in_q
=
0
);
bool
is_splocal
()
{
return
1
;
}
/* Needed for error checking */
...
...
sql/sp_head.cc
View file @
7b797aaa
...
...
@@ -927,7 +927,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
/* append the text between sp ref occurences */
res
|=
qbuf
.
append
(
cur
+
prev_pos
,
(
*
splocal
)
->
pos_in_query
-
prev_pos
);
prev_pos
=
(
*
splocal
)
->
pos_in_query
+
(
*
splocal
)
->
m_name
.
length
;
prev_pos
=
(
*
splocal
)
->
pos_in_query
+
(
*
splocal
)
->
len_in_query
;
/* append the spvar substitute */
res
|=
qbuf
.
append
(
STRING_WITH_LEN
(
" NAME_CONST('"
));
...
...
sql/sql_select.cc
View file @
7b797aaa
...
...
@@ -1134,6 +1134,7 @@ JOIN::optimize()
order
=
0
;
// The output has only one row
simple_order
=
1
;
select_distinct
=
0
;
// No need in distinct for 1 row
group_optimized_away
=
1
;
}
calc_group_buffer
(
this
,
group_list
);
...
...
@@ -11742,7 +11743,8 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
if
(
!
join
->
first_record
||
end_of_records
||
(
idx
=
test_if_group_changed
(
join
->
group_fields
))
>=
0
)
{
if
(
join
->
first_record
||
(
end_of_records
&&
!
join
->
group
))
if
(
join
->
first_record
||
(
end_of_records
&&
!
join
->
group
&&
!
join
->
group_optimized_away
))
{
if
(
join
->
procedure
)
join
->
procedure
->
end_group
();
...
...
sql/sql_select.h
View file @
7b797aaa
...
...
@@ -321,6 +321,14 @@ public:
ROLLUP
rollup
;
// Used with rollup
bool
select_distinct
;
// Set if SELECT DISTINCT
/*
If we have the GROUP BY statement in the query,
but the group_list was emptied by optimizer, this
flag is TRUE.
It happens when fields in the GROUP BY are from
constant table
*/
bool
group_optimized_away
;
/*
simple_xxxxx is set if ORDER/GROUP BY doesn't include any references
...
...
@@ -429,6 +437,7 @@ public:
zero_result_cause
=
0
;
optimized
=
0
;
cond_equal
=
0
;
group_optimized_away
=
0
;
all_fields
=
fields_arg
;
fields_list
=
fields_arg
;
...
...
sql/sql_yacc.yy
View file @
7b797aaa
...
...
@@ -9505,7 +9505,8 @@ simple_ident:
Item_splocal *splocal;
splocal= new Item_splocal($1, spv->offset, spv->type,
lip->get_tok_start_prev() -
lex->sphead->m_tmp_query);
lex->sphead->m_tmp_query,
lip->get_tok_end() - lip->get_tok_start_prev());
#ifndef DBUG_OFF
if (splocal)
splocal->m_sp= lex->sphead;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment