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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f87f2791
Commit
f87f2791
authored
Jun 07, 2004
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0-merge
parents
12b65b31
27abb692
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
484 additions
and
2 deletions
+484
-2
mysql-test/r/sp.result
mysql-test/r/sp.result
+225
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+255
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+3
-1
No files found.
mysql-test/r/sp.result
View file @
f87f2791
...
@@ -1093,6 +1093,231 @@ s1
...
@@ -1093,6 +1093,231 @@ s1
32767
32767
drop procedure bug2780|
drop procedure bug2780|
drop table t3|
drop table t3|
drop table if exists t3|
create table t3 (content varchar(10) )|
insert into t3 values ("test1")|
insert into t3 values ("test2")|
drop table if exists t4|
create table t4 (f1 int, rc int, t3 int)|
create procedure bug1863(in1 int)
begin
declare ind int default 0;
declare t1 int;
declare t2 int;
declare t3 int;
declare rc int default 0;
declare continue handler for 1065 set rc = 1;
drop table if exists temp_t1;
create temporary table temp_t1 (
f1 int auto_increment, f2 varchar(20), primary key (f1)
);
insert into temp_t1 (f2) select content from t3;
select f2 into t3 from temp_t1 where f1 = 10;
if (rc) then
insert into t4 values (1, rc, t3);
end if;
insert into t4 values (2, rc, t3);
end|
call bug1863(10)|
Warnings:
call bug1863(10)|
Warnings:
select * from t4|
f1 rc t3
2 0 NULL
2 0 NULL
drop procedure bug1863|
drop table t3, t4|
drop table if exists t3, t4|
create table t3 (
OrderID int not null,
MarketID int,
primary key (OrderID)
)|
create table t4 (
MarketID int not null,
Market varchar(60),
Status char(1),
primary key (MarketID)
)|
insert t3 (OrderID,MarketID) values (1,1)|
insert t3 (OrderID,MarketID) values (2,2)|
insert t4 (MarketID,Market,Status) values (1,"MarketID One","A")|
insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|
create procedure bug2656_1()
begin
select
m.Market
from t4 m JOIN t3 o
ON o.MarketID != 1 and o.MarketID = m.MarketID;
end |
create procedure bug2656_2()
begin
select
m.Market
from
t4 m, t3 o
where
m.MarketID != 1 and m.MarketID = o.MarketID;
end |
call bug2656_1()|
Market
MarketID Two
call bug2656_1()|
Market
MarketID Two
call bug2656_2()|
Market
MarketID Two
call bug2656_2()|
Market
MarketID Two
drop procedure bug2656_1|
drop procedure bug2656_2|
drop table t3, t4|
create procedure bug3426(in_time int unsigned, out x int)
begin
if in_time is null then
set @stamped_time=10;
set x=1;
else
set @stamped_time=in_time;
set x=2;
end if;
end|
call bug3426(1000, @i)|
select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
@i time
2 01-01-1970 03:16:40
call bug3426(NULL, @i)|
select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
@i time
1 01-01-1970 03:00:10
alter procedure bug3426 sql security invoker|
call bug3426(NULL, @i)|
select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
@i time
1 01-01-1970 03:00:10
call bug3426(1000, @i)|
select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
@i time
2 01-01-1970 03:16:40
drop procedure bug3426|
drop table if exists t3, t4|
create table t3 (
a int primary key,
ach char(1)
) engine = innodb|
create table t4 (
b int primary key ,
bch char(1)
) engine = innodb|
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
Warnings:
Warning 1265 Data truncated for column 'ach' at row 1
Warning 1265 Data truncated for column 'ach' at row 2
insert into t4 values (1 , 'bCh1' )|
Warnings:
Warning 1265 Data truncated for column 'bch' at row 1
create procedure bug3448()
select * from t3 inner join t4 on t3.a = t4.b|
select * from t3 inner join t4 on t3.a = t4.b|
a ach b bch
1 a 1 b
call bug3448()|
a ach b bch
1 a 1 b
call bug3448()|
a ach b bch
1 a 1 b
drop procedure bug3448|
drop table t3, t4|
drop table if exists t3|
create table t3 (
id int unsigned auto_increment not null primary key,
title VARCHAR(200),
body text,
fulltext (title,body)
)|
insert into t3 (title,body) values
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...')|
create procedure bug3734 (param1 varchar(100))
select * from t3 where match (title,body) against (param1)|
call bug3734('database')|
id title body
5 MySQL vs. YourSQL In the following database comparison ...
1 MySQL Tutorial DBMS stands for DataBase ...
call bug3734('Security')|
id title body
6 MySQL Security When configured properly, MySQL ...
drop procedure bug3734|
drop table t3|
create procedure bug3863()
begin
set @a = 0;
while @a < 5 do
set @a = @a + 1;
end while;
end|
call bug3863()|
select @a|
@a
5
call bug3863()|
select @a|
@a
5
drop procedure bug3863|
drop table if exists t3|
create table t3 (
id int(10) unsigned not null default 0,
rid int(10) unsigned not null default 0,
msg text not null,
primary key (id),
unique key rid (rid, id)
)|
create procedure bug2460_1(in v int)
begin
( select n0.id from t3 as n0 where n0.id = v )
union
( select n0.id from t3 as n0, t3 as n1
where n0.id = n1.rid and n1.id = v )
union
( select n0.id from t3 as n0, t3 as n1, t3 as n2
where n0.id = n1.rid and n1.id = n2.rid and n2.id = v );
end|
call bug2460_1(2)|
id
call bug2460_1(2)|
id
insert into t3 values (1, 1, 'foo'), (2, 1, 'bar'), (3, 1, 'zip zap')|
call bug2460_1(2)|
id
2
1
call bug2460_1(2)|
id
2
1
create procedure bug2460_2()
begin
drop table if exists t3;
create table t3 (s1 int);
insert into t3 select 1 union select 1;
end|
call bug2460_2()|
call bug2460_2()|
select * from t3|
s1
1
drop procedure bug2460_1|
drop procedure bug2460_2|
drop table t3|
drop table if exists fac|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
create procedure ifac(n int unsigned)
...
...
mysql-test/t/sp.test
View file @
f87f2791
...
@@ -1262,6 +1262,261 @@ select * from t3|
...
@@ -1262,6 +1262,261 @@ select * from t3|
drop
procedure
bug2780
|
drop
procedure
bug2780
|
drop
table
t3
|
drop
table
t3
|
#
# BUG#1863
#
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
content
varchar
(
10
)
)
|
insert
into
t3
values
(
"test1"
)
|
insert
into
t3
values
(
"test2"
)
|
--
disable_warnings
drop
table
if
exists
t4
|
--
enable_warnings
create
table
t4
(
f1
int
,
rc
int
,
t3
int
)
|
create
procedure
bug1863
(
in1
int
)
begin
declare
ind
int
default
0
;
declare
t1
int
;
declare
t2
int
;
declare
t3
int
;
declare
rc
int
default
0
;
declare
continue
handler
for
1065
set
rc
=
1
;
drop
table
if
exists
temp_t1
;
create
temporary
table
temp_t1
(
f1
int
auto_increment
,
f2
varchar
(
20
),
primary
key
(
f1
)
);
insert
into
temp_t1
(
f2
)
select
content
from
t3
;
select
f2
into
t3
from
temp_t1
where
f1
=
10
;
if
(
rc
)
then
insert
into
t4
values
(
1
,
rc
,
t3
);
end
if
;
insert
into
t4
values
(
2
,
rc
,
t3
);
end
|
call
bug1863
(
10
)
|
call
bug1863
(
10
)
|
select
*
from
t4
|
drop
procedure
bug1863
|
drop
table
t3
,
t4
|
#
# BUG#2656
#
--
disable_warnings
drop
table
if
exists
t3
,
t4
|
--
enable_warnings
create
table
t3
(
OrderID
int
not
null
,
MarketID
int
,
primary
key
(
OrderID
)
)
|
create
table
t4
(
MarketID
int
not
null
,
Market
varchar
(
60
),
Status
char
(
1
),
primary
key
(
MarketID
)
)
|
insert
t3
(
OrderID
,
MarketID
)
values
(
1
,
1
)
|
insert
t3
(
OrderID
,
MarketID
)
values
(
2
,
2
)
|
insert
t4
(
MarketID
,
Market
,
Status
)
values
(
1
,
"MarketID One"
,
"A"
)
|
insert
t4
(
MarketID
,
Market
,
Status
)
values
(
2
,
"MarketID Two"
,
"A"
)
|
create
procedure
bug2656_1
()
begin
select
m
.
Market
from
t4
m
JOIN
t3
o
ON
o
.
MarketID
!=
1
and
o
.
MarketID
=
m
.
MarketID
;
end
|
create
procedure
bug2656_2
()
begin
select
m
.
Market
from
t4
m
,
t3
o
where
m
.
MarketID
!=
1
and
m
.
MarketID
=
o
.
MarketID
;
end
|
call
bug2656_1
()
|
call
bug2656_1
()
|
call
bug2656_2
()
|
call
bug2656_2
()
|
drop
procedure
bug2656_1
|
drop
procedure
bug2656_2
|
drop
table
t3
,
t4
|
#
# BUG#3426
#
create
procedure
bug3426
(
in_time
int
unsigned
,
out
x
int
)
begin
if
in_time
is
null
then
set
@
stamped_time
=
10
;
set
x
=
1
;
else
set
@
stamped_time
=
in_time
;
set
x
=
2
;
end
if
;
end
|
call
bug3426
(
1000
,
@
i
)
|
select
@
i
,
from_unixtime
(
@
stamped_time
,
'%d-%m-%Y %h:%i:%s'
)
as
time
|
call
bug3426
(
NULL
,
@
i
)
|
select
@
i
,
from_unixtime
(
@
stamped_time
,
'%d-%m-%Y %h:%i:%s'
)
as
time
|
# Clear SP cache
alter
procedure
bug3426
sql
security
invoker
|
call
bug3426
(
NULL
,
@
i
)
|
select
@
i
,
from_unixtime
(
@
stamped_time
,
'%d-%m-%Y %h:%i:%s'
)
as
time
|
call
bug3426
(
1000
,
@
i
)
|
select
@
i
,
from_unixtime
(
@
stamped_time
,
'%d-%m-%Y %h:%i:%s'
)
as
time
|
drop
procedure
bug3426
|
#
# BUG#3448
#
--
disable_warnings
drop
table
if
exists
t3
,
t4
|
--
enable_warnings
create
table
t3
(
a
int
primary
key
,
ach
char
(
1
)
)
engine
=
innodb
|
create
table
t4
(
b
int
primary
key
,
bch
char
(
1
)
)
engine
=
innodb
|
insert
into
t3
values
(
1
,
'aCh1'
)
,
(
'2'
,
'aCh2'
)
|
insert
into
t4
values
(
1
,
'bCh1'
)
|
create
procedure
bug3448
()
select
*
from
t3
inner
join
t4
on
t3
.
a
=
t4
.
b
|
select
*
from
t3
inner
join
t4
on
t3
.
a
=
t4
.
b
|
call
bug3448
()
|
call
bug3448
()
|
drop
procedure
bug3448
|
drop
table
t3
,
t4
|
#
# BUG#3734
#
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
id
int
unsigned
auto_increment
not
null
primary
key
,
title
VARCHAR
(
200
),
body
text
,
fulltext
(
title
,
body
)
)
|
insert
into
t3
(
title
,
body
)
values
(
'MySQL Tutorial'
,
'DBMS stands for DataBase ...'
),
(
'How To Use MySQL Well'
,
'After you went through a ...'
),
(
'Optimizing MySQL'
,
'In this tutorial we will show ...'
),
(
'1001 MySQL Tricks'
,
'1. Never run mysqld as root. 2. ...'
),
(
'MySQL vs. YourSQL'
,
'In the following database comparison ...'
),
(
'MySQL Security'
,
'When configured properly, MySQL ...'
)
|
create
procedure
bug3734
(
param1
varchar
(
100
))
select
*
from
t3
where
match
(
title
,
body
)
against
(
param1
)
|
call
bug3734
(
'database'
)
|
call
bug3734
(
'Security'
)
|
drop
procedure
bug3734
|
drop
table
t3
|
#
# BUG#3863
#
create
procedure
bug3863
()
begin
set
@
a
=
0
;
while
@
a
<
5
do
set
@
a
=
@
a
+
1
;
end
while
;
end
|
call
bug3863
()
|
select
@
a
|
call
bug3863
()
|
select
@
a
|
drop
procedure
bug3863
|
#
# BUG#2460
#
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
id
int
(
10
)
unsigned
not
null
default
0
,
rid
int
(
10
)
unsigned
not
null
default
0
,
msg
text
not
null
,
primary
key
(
id
),
unique
key
rid
(
rid
,
id
)
)
|
create
procedure
bug2460_1
(
in
v
int
)
begin
(
select
n0
.
id
from
t3
as
n0
where
n0
.
id
=
v
)
union
(
select
n0
.
id
from
t3
as
n0
,
t3
as
n1
where
n0
.
id
=
n1
.
rid
and
n1
.
id
=
v
)
union
(
select
n0
.
id
from
t3
as
n0
,
t3
as
n1
,
t3
as
n2
where
n0
.
id
=
n1
.
rid
and
n1
.
id
=
n2
.
rid
and
n2
.
id
=
v
);
end
|
call
bug2460_1
(
2
)
|
call
bug2460_1
(
2
)
|
insert
into
t3
values
(
1
,
1
,
'foo'
),
(
2
,
1
,
'bar'
),
(
3
,
1
,
'zip zap'
)
|
call
bug2460_1
(
2
)
|
call
bug2460_1
(
2
)
|
create
procedure
bug2460_2
()
begin
drop
table
if
exists
t3
;
create
table
t3
(
s1
int
);
insert
into
t3
select
1
union
select
1
;
end
|
call
bug2460_2
()
|
call
bug2460_2
()
|
select
*
from
t3
|
drop
procedure
bug2460_1
|
drop
procedure
bug2460_2
|
drop
table
t3
|
#
#
# Some "real" examples
# Some "real" examples
...
...
sql/sql_parse.cc
View file @
f87f2791
...
@@ -3488,7 +3488,7 @@ mysql_execute_command(THD *thd)
...
@@ -3488,7 +3488,7 @@ mysql_execute_command(THD *thd)
}
}
if
(
res
==
0
)
if
(
res
==
0
)
send_ok
(
thd
,
thd
->
row_count_func
);
send_ok
(
thd
,
(
thd
->
row_count_func
<
0
?
0
:
thd
->
row_count_func
)
);
else
else
goto
error
;
// Substatement should already have sent error
goto
error
;
// Substatement should already have sent error
}
}
...
...
sql/sql_union.cc
View file @
f87f2791
...
@@ -487,7 +487,9 @@ int st_select_lex_unit::exec()
...
@@ -487,7 +487,9 @@ int st_select_lex_unit::exec()
else
else
{
{
JOIN_TAB
*
tab
,
*
end
;
JOIN_TAB
*
tab
,
*
end
;
for
(
tab
=
join
->
join_tab
,
end
=
tab
+
join
->
tables
;
tab
!=
end
;
tab
++
)
for
(
tab
=
join
->
join_tab
,
end
=
tab
+
join
->
tables
;
tab
&&
tab
!=
end
;
tab
++
)
{
{
delete
tab
->
select
;
delete
tab
->
select
;
delete
tab
->
quick
;
delete
tab
->
quick
;
...
...
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